# 节流
节流函数,经常用于监听滚动条事件
import { debounce } from 'util-snippets'
deepClone(fn(),time)
const debounce = (fn, interval = 600) => {
let timeout: any = null;
return () => {
clearTimeout(timeout);
timeout = setTimeout(() => {
fn.apply();
}, interval);
};
}
← 防抖 获取数组中获取某个元素重复出现次数 →