perbaikan dashboard
This commit is contained in:
8
src/lib/utils/debounce.ts
Normal file
8
src/lib/utils/debounce.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export function debounce<T extends (...args: any[]) => void>(func: T, delay: number): (...args: Parameters<T>) => void {
|
||||
let timeout: ReturnType<typeof setTimeout>;
|
||||
return function (this: ThisParameterType<T>, ...args: Parameters<T>) {
|
||||
const context = this;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => func.apply(context, args), delay);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user