Mercurial > xmpp-account-manager
changeset 19:bde4f0bbfe69
Clear a spinner’s timeout on change if it had been set previously.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 22 Dec 2018 19:53:01 +0100 |
parents | 3c02cbced2df |
children | 46660687924b |
files | util.js |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util.js +++ b/util.js @@ -44,23 +44,31 @@ function configurePEPField(node, key, va } function displaySpinner(spinner) { + if ('timeoutid' in spinner.dataset) + clearTimeout(spinner.dataset.timeoutid); spinner.src = 'spinner.svg'; spinner.hidden = false; } function spinnerOk(spinner) { + if ('timeoutid' in spinner.dataset) + clearTimeout(spinner.dataset.timeoutid); spinner.src = 'ok.svg'; spinner.hidden = false; - setTimeout(function () { + spinner.dataset.timeoutid = setTimeout(function () { spinner.hidden = true; }, 1000); } function spinnerError(spinner) { + if ('timeoutid' in spinner.dataset) + clearTimeout(spinner.dataset.timeoutid); spinner.src = 'error.svg'; spinner.hidden = false; } function hideSpinner(spinner) { + if ('timeoutid' in spinner.dataset) + clearTimeout(spinner.dataset.timeoutid); spinner.hidden = true; }