introduce debounce on output updates + linked box

This commit is contained in:
David Meincke
2022-03-23 21:31:04 +01:00
parent f25f3daf7f
commit ad53ae9695
15 changed files with 211 additions and 45 deletions
+4
View File
@@ -1,7 +1,11 @@
import { executeDrawQueue } from "../outputframe-app/injects/dom-helpers";
export function createScript(value: string) {
var script: HTMLScriptElement = document.createElement("script");
script.setAttribute("async", "");
script.innerHTML = value;
document.body.appendChild(script);
executeDrawQueue();
}
+16
View File
@@ -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);
}
}
}