feat(individual parts): lock the submit button when processing

This commit is contained in:
Xmader 2020-10-20 00:55:40 -04:00
parent c546ebdb83
commit d124065af2
1 changed files with 7 additions and 1 deletions

View File

@ -91,13 +91,19 @@ const main = (): void => {
submitBtn.value = 'Download PDF'
fieldset.append(submitBtn)
submitBtn.onclick = async (): Promise<void> => {
const onSubmit = async (): Promise<void> => {
// lock the button when processing
submitBtn.onclick = null
const checked = fieldset.querySelector('input:checked') as HTMLInputElement
const partName = checked.alt
const data = new Blob([await score.savePdf()])
saveAs(data, `${filename} - ${partName}.pdf`)
submitBtn.onclick = onSubmit
}
submitBtn.onclick = onSubmit
}),
})