mirror of
https://github.com/zadam/trilium.git
synced 2025-12-24 00:59:55 +01:00
client/debouncer: report pending updates before destroying
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user