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