Use a Promise to trigger callback when delay is 0 or less

This commit is contained in:
toasted-nutbread 2019-09-19 19:00:26 -04:00
parent e3fb9603e2
commit f022ee4eca

View File

@ -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() {