mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 18:06:22 +00:00
7 lines
254 B
TypeScript
7 lines
254 B
TypeScript
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;
|
|
}
|