diff options
Diffstat (limited to 'web/pw-server/src/lib/utils.ts')
-rw-r--r-- | web/pw-server/src/lib/utils.ts | 9 |
1 files changed, 9 insertions, 0 deletions
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<typeof setTimeout>; + return (...args: any[]) => { + clearTimeout(timer); + timer = setTimeout(() => { + func.apply(this, args); + }, timeout); + }; +} |