blob: 6a1756b2b515325055d02828c6b7327891461674 (
plain)
1
2
3
4
5
6
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;
}
|