From f022ee4eca9611dbea9fd3eb457d47dd58679190 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 19 Sep 2019 19:00:26 -0400 Subject: Use a Promise to trigger callback when delay is 0 or less --- ext/fg/js/frontend.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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() { -- cgit v1.2.3