zhouwx
2024-11-12 a925a64cd7ab1935717fceb0fba5eb67f0bbf75c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export function debounce(func, delay) {
  let timeoutId;
 
  return function() {
    const context = this;
    const args = arguments;
 
    clearTimeout(timeoutId);
 
    timeoutId = setTimeout(function() {
      func.apply(context, args);
    }, delay);
  };
}