all repos — kōi @ 06d6c343bb7f758261d0ed471cf4711ef5310723

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};