@prelude/function
Version:
Function module.
19 lines • 440 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const throttle = (wait, f) => {
let n = 0;
const g = () => {
if (n++ === 0) {
setTimeout(() => {
if (--n > 0) {
n = 0;
g();
}
}, wait);
f();
}
};
return g;
};
exports.default = throttle;
//# sourceMappingURL=throttle.js.map