Merge pull request #220 from toasted-nutbread/zero-scanning-delay-timeout
Use a Promise to trigger callback when delay is 0 or less
This commit is contained in:
commit
64eec04a2e
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user