"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.throttle = void 0;
const throttle = (fn, ms = 25) => {
    let timer;
    let lastArgs;
    const stop = () => {
        if (timer) {
            clearTimeout(timer);
            timer = 0;
        }
    };
    const out = ((...args) => {
        lastArgs = args;
        if (timer)
            return;
        timer = setTimeout(() => {
            timer = 0;
            fn.apply(null, lastArgs);
        }, ms);
    });
    return [out, stop];
};
exports.throttle = throttle;
//# sourceMappingURL=throttle.js.map