MCPcopy Create free account
hub / github.com/ccj-007/easy-lowcode / throttle

Function throttle

src/utils/index.ts:1–13  ·  view source on GitHub ↗
(func: Function, wait: number = 1000)

Source from the content-addressed store, hash-verified

1function throttle(func: Function, wait: number = 1000) {
2 var context, args;
3 var previous = 0;
4 return function () {
5 var now = +new Date();
6 context = this;
7 args = arguments;
8 if (now - previous > wait) {
9 func.apply(context, args);
10 previous = now;
11 }
12 }
13}
14
15const utils = {
16 throttle

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected