mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-14 23:33:42 -05:00
7 lines
253 B
TypeScript
7 lines
253 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;
|
||
|
}
|