all repos — kōi @ 34fc5a7eee3f118204f674fb93239c0233b434bd

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