diff --git a/app.js b/app.js index 961ce94..f0958c6 100644 --- a/app.js +++ b/app.js @@ -47,6 +47,8 @@ function getHasher(hashType) { const buttonText = e.target.innerText e.target.innerText = "Calculating hash…" + document.getElementById("hash-container").classList.remove("done") + const formData = new FormData(document.getElementById("hash-setup")) const hashSetup = getHashSetup(formData) @@ -54,9 +56,13 @@ function getHasher(hashType) { const hasher = getHasher(hashSetup.hashType) - displayHash(hasher(hashSetup.password, hashSetup.privateOptions)) + // Hack for enforcing that the DOM changes get propagated to the view + // before the hash is calculated (which blocks the thread). + setTimeout(() => { + displayHash(hasher(hashSetup.password, hashSetup.privateOptions)) - e.target.innerText = buttonText - e.target.disabled = false + e.target.innerText = buttonText + e.target.disabled = false + }, 0) }) })()