legends810/testingnew
0
1export function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void {2 let timeout: NodeJS.Timeout;3 4 return function executedFunction(...args: Parameters<T>) {5 const later = () => {6 clearTimeout(timeout);7 func(...args);8 };9 10 clearTimeout(timeout);11 timeout = setTimeout(later, wait);12 };13}14 