mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 16:14:23 +01:00
client/debouncer: report pending updates before destroying
Some checks are pending
Checks / main (push) Waiting to run
Some checks are pending
Checks / main (push) Waiting to run
This commit is contained in:
parent
79dc5e4344
commit
c25859cee9
@ -14,12 +14,15 @@ export default class Debouncer<T> {
|
||||
|
||||
updateValue(value: T) {
|
||||
this.lastValue = value;
|
||||
this.destroy();
|
||||
if (this.timeoutId !== null) {
|
||||
clearTimeout(this.timeoutId);
|
||||
}
|
||||
this.timeoutId = setTimeout(this.reportUpdate.bind(this), this.debounceInterval);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
if (this.timeoutId !== null) {
|
||||
this.reportUpdate();
|
||||
clearTimeout(this.timeoutId);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user