summaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-19 19:00:26 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-19 19:00:26 -0400
commitf022ee4eca9611dbea9fd3eb457d47dd58679190 (patch)
tree003cb57102f21323c0f84cbb0e4065be54c0b899 /ext/fg
parente3fb9603e22c5cbdc7cdf00b60e8ccbf1c7e2116 (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.js7
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() {