A deployable markdown editor that connects with your self hosted files and lets you edit in a beautiful interface
1export function debounce<T extends (...args: any[]) => any>(
2 func: T,
3 wait: number
4): (...args: Parameters<T>) => void {
5 let timeout: ReturnType<typeof setTimeout> | null = null;
6
7 return function executedFunction(...args: Parameters<T>) {
8 const later = () => {
9 timeout = null;
10 func(...args);
11 };
12
13 if (timeout) {
14 clearTimeout(timeout);
15 }
16 timeout = setTimeout(later, wait);
17 };
18}