Coves frontend - a photon fork
at main 7 lines 242 B view raw
1export const debounce = (fn: Function, ms = 300) => { 2 let timeoutId: ReturnType<typeof setTimeout> 3 return function (this: any, ...args: any[]) { 4 clearTimeout(timeoutId) 5 timeoutId = setTimeout(() => fn.apply(this, args), ms) 6 } 7}