aboutsummaryrefslogtreecommitdiff
path: root/src/lib/function.ts
blob: db7b436c719d517041f468f095c0a8b3d9cdce99 (plain)
1
2
3
4
5
6
7
export function debounce(func: any, timeout = 300){
  let timer: any;
  return (...args: any) => {
    clearTimeout(timer);
    timer = setTimeout(() => { func.apply(this, args); }, timeout);
  };
}