all repos — kōi @ 733b1e68ded9a74d31e7b734fc5fb0064d5c0bd2

Minimalist task manager

src/lib/utils.ts (view raw)

1export const debounce = (callback: Function, wait = 300) => {
2  let timeout: ReturnType<typeof setTimeout>;
3
4  return (...args: any[]) => {
5    clearTimeout(timeout);
6    timeout = setTimeout(() => callback(...args), wait);
7  };
8};