UNPKG

@prelude/function

Version:

Function module.

17 lines 360 B
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