Files
photon-tbw/src/lib/ui/shared/util/time.ts
T
2025-09-24 17:12:19 -07:00

8 lines
242 B
TypeScript

export const debounce = (fn: Function, ms = 300) => {
let timeoutId: ReturnType<typeof setTimeout>
return function (this: any, ...args: any[]) {
clearTimeout(timeoutId)
timeoutId = setTimeout(() => fn.apply(this, args), ms)
}
}