马宇豪
2024-06-05 aa7e52de08a8905fd58cb9884d30a43fc1cd2f80
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);
  };
}