diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-19 19:00:26 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-19 19:00:26 -0400 |
commit | f022ee4eca9611dbea9fd3eb457d47dd58679190 (patch) | |
tree | 003cb57102f21323c0f84cbb0e4065be54c0b899 /ext/fg | |
parent | e3fb9603e22c5cbdc7cdf00b60e8ccbf1c7e2116 (diff) |
Use a Promise to trigger callback when delay is 0 or less
Diffstat (limited to 'ext/fg')
-rw-r--r-- | ext/fg/js/frontend.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index c98a9a33..564df343 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -269,7 +269,12 @@ class Frontend { } popupTimerSet(callback) { - this.popupTimer = window.setTimeout(callback, this.options.scanning.delay); + const delay = this.options.scanning.delay; + if (delay > 0) { + this.popupTimer = window.setTimeout(callback, delay); + } else { + Promise.resolve().then(callback); + } } popupTimerClear() { |