Spaces:
Running
Running
File size: 358 Bytes
a990603 8a37195 | 1 2 3 4 5 6 7 8 9 10 11 12 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
export function debounce<F extends (...args: any[]) => void>(
func: F,
waitFor: number,
): (...args: Parameters<F>) => void {
let timeoutId: number;
return (...args: Parameters<F>) => {
clearTimeout(timeoutId);
timeoutId = window.setTimeout(() => func(...args), waitFor);
};
}
|