Use a Promise to trigger callback when delay is 0 or less
This commit is contained in:
parent
e3fb9603e2
commit
f022ee4eca
@ -269,7 +269,12 @@ class Frontend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
popupTimerSet(callback) {
|
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() {
|
popupTimerClear() {
|
||||||
|
Loading…
Reference in New Issue
Block a user