refactor: clean up unused imports and improve file loading logic

This commit is contained in:
grngxd 2025-07-31 12:29:37 +01:00
parent 4f54880400
commit 31a8d62f1d
4 changed files with 105 additions and 67 deletions

7
src/lib/misc.ts Normal file
View file

@ -0,0 +1,7 @@
export function debounce<T extends (...args: any[]) => void>(fn: T, delay = 200) {
let timer: ReturnType<typeof setTimeout> | null = null;
return (...args: Parameters<T>) => {
if (timer) clearTimeout(timer);
timer = setTimeout(async () => await fn(...args), delay);
};
}