MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / debounce

Function debounce

apps/desktop/src/main/app-config.ts:554–566  ·  view source on GitHub ↗
(
  fn: (...args: Args) => void,
  ms: number
)

Source from the content-addressed store, hash-verified

552}
553
554function debounce<Args extends unknown[]>(
555 fn: (...args: Args) => void,
556 ms: number
557): (...args: Args) => void {
558 let timer: ReturnType<typeof setTimeout> | null = null
559 return (...args: Args) => {
560 if (timer) clearTimeout(timer)
561 timer = setTimeout(() => {
562 timer = null
563 fn(...args)
564 }, ms)
565 }
566}
567
568function startWatching(): void {
569 const file = getConfigFilePath()

Callers 1

startWatchingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected