| 123456789101112131415 |
- /* eslint-disable */
- const debounce = (fn: Function, delay: number) => {
- let timer: NodeJS.Timeout | null = null;
- return function () {
- // @ts-ignore
- const context = this;
- const args = arguments;
- if (timer) {
- clearTimeout(timer);
- }
- timer = setTimeout(fn.apply(context, args), delay);
- };
- };
- export default debounce;
|