Refactor function definitions

This commit is contained in:
Leonardo Murça 2022-11-18 11:26:11 -03:00
parent 5e20ca53ce
commit d204618acd

View file

@ -7,15 +7,15 @@
const acceptedFiles = [".pes"]; const acceptedFiles = [".pes"];
const maxFileSize = 700000; const maxFileSize = 700000;
function onSubmit() { const onSubmit = () => {
filesRendered = true; filesRendered = true;
} };
function onDrop(evt) { const onDrop = (evt) => {
onChange(evt); onChange(evt);
} };
function onChange(evt) { const onChange = (evt) => {
files = null; files = null;
filesRefs = []; filesRefs = [];
filesRendered = false; filesRendered = false;
@ -35,23 +35,23 @@
} }
} }
files = filesToUpload; files = filesToUpload;
} };
function onClick() { const onClick = () => {
document.getElementById("file-input").click(); document.getElementById("file-input").click();
} };
function onKeydown(evt) { const onKeydown = (evt) => {
if (evt.key === "Enter") { if (evt.key === "Enter") {
document.getElementById("file-input").click(); document.getElementById("file-input").click();
} }
} };
</script> </script>
<form <form
on:submit|preventDefault|stopPropagation={onSubmit}
id="form" id="form"
enctype="multipart/form-data" enctype="multipart/form-data"
on:submit|preventDefault|stopPropagation={onSubmit}
> >
<h2>Upload files</h2> <h2>Upload files</h2>
<p> <p>