refactor: clean up form code

web-rdp-cloud-fixes
Parkreiner 10 months ago
parent 8195cf4453
commit 652fc6b84f

@ -426,19 +426,12 @@ function hideFormForInitialSubmission() {
rootNode.style.setProperty("--coder-opacity-multiplier", "1"); rootNode.style.setProperty("--coder-opacity-multiplier", "1");
}; };
const timeoutId = window.setTimeout(() => { // If this file gets more complicated, it might make sense to set up the
restoreOpacity(); // timeout and event listener so that if one triggers, it cancels the other,
form.removeEventListener("submit", restoreOpacity); // but having restoreOpacity run more than once is a no-op for right now.
}, 5_000); // Not a big deal if these don't get cleaned up.
window.setTimeout(restoreOpacity, 5_000);
form.addEventListener( form.addEventListener("submit", restoreOpacity, { once: true });
"submit",
() => {
restoreOpacity();
window.clearTimeout(timeoutId);
},
{ once: true },
);
}; };
intervalId = window.setInterval( intervalId = window.setInterval(

Loading…
Cancel
Save