From 006ce356220c1a089fc468bbfdc0dea819cd9288 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Tue, 22 Feb 2022 18:48:59 +0100 Subject: persist bot code in localstorage --- web/pw-server/src/lib/utils.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 web/pw-server/src/lib/utils.ts (limited to 'web/pw-server/src/lib/utils.ts') diff --git a/web/pw-server/src/lib/utils.ts b/web/pw-server/src/lib/utils.ts new file mode 100644 index 0000000..aab9734 --- /dev/null +++ b/web/pw-server/src/lib/utils.ts @@ -0,0 +1,9 @@ +export function debounce(func: Function, timeout: number = 300) { + let timer: ReturnType; + return (...args: any[]) => { + clearTimeout(timer); + timer = setTimeout(() => { + func.apply(this, args); + }, timeout); + }; +} -- cgit v1.2.3