diff options
author | Vendicated <vendicated@riseup.net> | 2022-09-02 16:15:47 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-09-02 16:15:47 +0200 |
commit | 68057d49e8bb602e0094fc4af785363752f05419 (patch) | |
tree | e4f030d16def56fe6be2ac951f870e63ae1a27e4 /src/utils/debounce.ts | |
parent | 02aeca6b73c5ed954e229863eb71737b6618312b (diff) | |
download | Vencord-68057d49e8bb602e0094fc4af785363752f05419.tar.gz Vencord-68057d49e8bb602e0094fc4af785363752f05419.tar.bz2 Vencord-68057d49e8bb602e0094fc4af785363752f05419.zip |
Debounce CssWatcher, fix empty tooltips in settings
Diffstat (limited to 'src/utils/debounce.ts')
-rw-r--r-- | src/utils/debounce.ts | 7 |
1 files changed, 7 insertions, 0 deletions
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<T extends Function>(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 |