MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / throttle

Function throttle

packages/core/utils/shared.ts:29–40  ·  view source on GitHub ↗
(fn: Function, delay = 300)

Source from the content-addressed store, hash-verified

27 * @returns A new throttled function
28 */
29export function throttle(fn: Function, delay = 300) {
30 let waiting = false;
31 return function (...args) {
32 if (!waiting) {
33 fn.apply(this, args);
34 waiting = true;
35 setTimeout(function () {
36 waiting = false;
37 }, delay);
38 }
39 };
40}

Callers 2

queueGCFunction · 0.90
queueGCFunction · 0.90

Calls 2

setTimeoutFunction · 0.50
applyMethod · 0.45

Tested by

no test coverage detected