Debounce CssWatcher, fix empty tooltips in settings

This commit is contained in:
Vendicated 2022-09-02 16:15:47 +02:00
parent 02aeca6b73
commit 68057d49e8
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
4 changed files with 14 additions and 6 deletions

7
src/utils/debounce.ts Normal file
View file

@ -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;
}