aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/lib/utils.ts
blob: aab9734976320ac61abb37ce7dd6d9c514539a77 (plain)
1
2
3
4
5
6
7
8
9
export function debounce(func: Function, timeout: number = 300) {
  let timer: ReturnType<typeof setTimeout>;
  return (...args: any[]) => {
    clearTimeout(timer);
    timer = setTimeout(() => {
      func.apply(this, args);
    }, timeout);
  };
}