aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2019-09-22 10:05:53 -0700
committerGitHub <noreply@github.com>2019-09-22 10:05:53 -0700
commit64eec04a2e7d35a5f94ea568588695f5d0e46c39 (patch)
tree003cb57102f21323c0f84cbb0e4065be54c0b899
parente3fb9603e22c5cbdc7cdf00b60e8ccbf1c7e2116 (diff)
parentf022ee4eca9611dbea9fd3eb457d47dd58679190 (diff)
Merge pull request #220 from toasted-nutbread/zero-scanning-delay-timeout
Use a Promise to trigger callback when delay is 0 or less
-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() {