...
This commit is contained in:
8
src/lib/util/debounce.ts
Normal file
8
src/lib/util/debounce.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export function debounce<T extends Function>(cb: T, wait = 500) {
|
||||
let h: any;
|
||||
let callable = () => {
|
||||
clearTimeout(h);
|
||||
h = setTimeout(() => cb(), wait);
|
||||
};
|
||||
return callable;
|
||||
}
|
||||
Reference in New Issue
Block a user