frontend: Fix progress indicator
This commit is contained in:
parent
3212cdeb50
commit
0c824b5af7
12
app.js
12
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)
|
||||
})
|
||||
})()
|
||||
|
|
Loading…
Reference in a new issue