MCPcopy
hub / github.com/xnimorz/use-debounce / trailingEdge

Function trailingEdge

src/useDebouncedCallback.ts:211–222  ·  view source on GitHub ↗
(time: number)

Source from the content-addressed store, hash-verified

209 };
210
211 const trailingEdge = (time: number) => {
212 timerId.current = null;
213
214 // Only invoke if we have `lastArgs` which means `func` has been
215 // debounced at least once.
216 if (trailing && lastArgs.current) {
217 return invokeFunc(time);
218 }
219
220 lastArgs.current = lastThis.current = null;
221 return result.current;
222 };
223
224 const timerExpired = () => {
225 const time = Date.now();

Callers 2

timerExpiredFunction · 0.85
useDebouncedCallbackFunction · 0.85

Calls 1

invokeFuncFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…