mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 08:04:24 +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) {
|
updateValue(value: T) {
|
||||||
this.lastValue = value;
|
this.lastValue = value;
|
||||||
this.destroy();
|
if (this.timeoutId !== null) {
|
||||||
|
clearTimeout(this.timeoutId);
|
||||||
|
}
|
||||||
this.timeoutId = setTimeout(this.reportUpdate.bind(this), this.debounceInterval);
|
this.timeoutId = setTimeout(this.reportUpdate.bind(this), this.debounceInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
if (this.timeoutId !== null) {
|
if (this.timeoutId !== null) {
|
||||||
|
this.reportUpdate();
|
||||||
clearTimeout(this.timeoutId);
|
clearTimeout(this.timeoutId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user