all repos — kōi @ 13ba0aa72c94f508c54f3862f99e195a4ec73f4c

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