MCPcopy Create free account
hub / github.com/benjitaylor/agentation / debounce

Function debounce

package/example/src/hooks/useActiveScrollElement.ts:7–13  ·  view source on GitHub ↗
(fn: T, ms: number)

Source from the content-addressed store, hash-verified

5
6// Simple debounce function (no lodash dependency)
7function debounce<T extends (...args: unknown[]) => void>(fn: T, ms: number): T {
8 let timer: ReturnType<typeof setTimeout>;
9 return ((...args: unknown[]) => {
10 clearTimeout(timer);
11 timer = setTimeout(() => fn(...args), ms);
12 }) as T;
13}
14
15type Options = {
16 /** The id of the element to consider active by default */

Callers 1

useActiveScrollElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…