MCPcopy Create free account
hub / github.com/arethetypeswrong/arethetypeswrong.github.io / debounce

Function debounce

packages/web/src/main.ts:161–172  ·  view source on GitHub ↗
(fn: (value: T) => void, delay: number)

Source from the content-addressed store, hash-verified

159}
160
161function debounce<T>(fn: (value: T) => void, delay: number) {
162 let timeout: number | undefined;
163 return (value: T) => {
164 if (timeout !== undefined) {
165 clearTimeout(timeout);
166 }
167 timeout = setTimeout(() => {
168 timeout = undefined;
169 fn(value);
170 }, delay);
171 };
172}

Callers 1

main.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected