UNPKG
@prelude/function
Version:
latest (0.4.1)
0.4.1
0.4.0
0.3.0
0.2.0
0.1.0
0.0.3
Function module.
@prelude/function
/
mjs
/
throttle.js
17 lines
•
360 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const
throttle
= (
wait, f
) => {
let
n =
0
;
const
g
= (
) => {
if
(n++ ===
0
) {
setTimeout
(
() =>
{
if
(--n >
0
) { n =
0
;
g
(); } }, wait);
f
(); } };
return
g; };
export
default
throttle;
//# sourceMappingURL=throttle.js.map