introduce debounce on output updates + linked box
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
export function debounceManager(debounceTime: number): { ensureDebounce: (fn: Function) => void } {
|
||||
|
||||
var curHandle: number | null = null;
|
||||
|
||||
return {
|
||||
ensureDebounce: (fn: Function) => {
|
||||
if (curHandle != null) {
|
||||
clearInterval(curHandle);
|
||||
curHandle = null;
|
||||
}
|
||||
curHandle = setTimeout(() => {
|
||||
fn();
|
||||
}, debounceTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user