export 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];
};
//# sourceMappingURL=throttle.js.map