char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
59778f019
char/aliceai-t5-moe
1/** 2* @param fn - The function to debounce 3* @param delay - The delay in milliseconds 4* @returns A debounced version of the function 5*/ 6export function debounce < T extends ( ...args :Parameters < T >) => void > ( 7fn :T , 8delay :number 9) :( ...args :Parameters < T >) => void { 10let timeoutId :ReturnType < typeof setTimeout > | null = null ; 11 12return ( ...args :Parameters < T >) => { 13if ( timeoutId ) { 14clearTimeout ( timeoutId ); 15} 16 17timeoutId = setTimeout (() => { 18fn ( ...args ); 19timeoutId = null ; 20}, delay ); 21}; 22}