| export const debounce = (fn: (...args: any[]) => any, ms = 300) => { | |
| let timeoutId: ReturnType<typeof setTimeout>; | |
| return function (this: any, ...args: any[]) { | |
| clearTimeout(timeoutId); | |
| timeoutId = setTimeout(() => fn.apply(this, args), ms); | |
| }; | |
| }; | |
| export const debounce = (fn: (...args: any[]) => any, ms = 300) => { | |
| let timeoutId: ReturnType<typeof setTimeout>; | |
| return function (this: any, ...args: any[]) { | |
| clearTimeout(timeoutId); | |
| timeoutId = setTimeout(() => fn.apply(this, args), ms); | |
| }; | |
| }; | |