debounce function

Last updated: 2026-03-03T18:32:34.140Z

Metrics

LOC: 7 Complexity: 2 Params: 1

Signature

debounce(fn: () => void, ms: number): : () => void

Source Code

function debounce(fn: () => void, ms: number): () => void {
  let timer: ReturnType<typeof setTimeout> | null = null;
  return () => {
    if (timer) clearTimeout(timer);
    timer = setTimeout(fn, ms);
  };
}

Dependencies (Outgoing)

graph LR debounce["debounce"] DetectionStrategyEntry["DetectionStrategyEntry"] Settings["Settings"] t["t"] initI18n["initI18n"] localizeHTML["localizeHTML"] escapeHtml["escapeHtml"] showToast["showToast"] debounce -->|uses| DetectionStrategyEntry debounce -->|uses| Settings debounce -->|uses| t debounce -->|uses| initI18n debounce -->|uses| localizeHTML debounce -->|uses| escapeHtml debounce -->|uses| showToast style debounce fill:#dbeafe,stroke:#2563eb,stroke-width:2px click debounce "806c18ff0675c421.html" click DetectionStrategyEntry "3a7a3e9e6181f73d.html" click Settings "dbe5880af98e954d.html" click t "8e8864a3c5cfd1e1.html" click initI18n "6ba39c0538592b1c.html" click localizeHTML "ea912f73a0316785.html" click escapeHtml "67836c1424e9ebff.html" click showToast "087fe5d2f8cca7e9.html"
TargetType
DetectionStrategyEntry uses
Settings uses
t uses
initI18n uses
localizeHTML uses
escapeHtml uses
showToast uses

No incoming dependencies.