# 节流

节流函数,经常用于监听滚动条事件

使用
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);
  };
}