From 68057d49e8bb602e0094fc4af785363752f05419 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 2 Sep 2022 16:15:47 +0200 Subject: Debounce CssWatcher, fix empty tooltips in settings --- src/utils/debounce.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/utils/debounce.ts (limited to 'src/utils') diff --git a/src/utils/debounce.ts b/src/utils/debounce.ts new file mode 100644 index 0000000..6a1756b --- /dev/null +++ b/src/utils/debounce.ts @@ -0,0 +1,7 @@ +export function debounce(func: T, delay = 300): T { + let timeout: NodeJS.Timeout; + return function (...args: any[]) { + clearTimeout(timeout); + timeout = setTimeout(() => { func(...args); }, delay); + } as any; +} \ No newline at end of file -- cgit