You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* await fn(50); // takes ~50ms to execute, after which it will be throttled for 50ms * 2 = 100ms
85
-
* assertEquals(timesCalled, 1);
86
-
* await delay(50);
87
-
* await fn(50);
88
-
* assertEquals(timesCalled, 1); // still throttled
89
-
* await delay(30);
90
-
* await fn(50);
91
-
* assertEquals(timesCalled, 1); // still throttled
92
-
* await delay(30);
93
-
* await fn(50);
94
-
* assertEquals(timesCalled, 2); // not throttled this time
95
-
* ```
96
-
*
97
73
* @typeParam T The arguments of the provided function.
98
74
* @param fn The function to throttle.
99
-
* @param timeframe The timeframe in milliseconds in which the function should be called at most once. If a callback function is supplied, it will be called with the duration of the previous execution and should return the next timeframe to use in milliseconds.
75
+
* @param timeframe The timeframe in milliseconds in which the function should be called at most once.
76
+
* If a callback function is supplied, it will be called with the duration of
0 commit comments