/** @returns Throttled function that can be called at most once in given waitTime(ms). */
const throttle = (fn, waitTime) => {
    let paused = false;
    let latestArgs;
    return function throttled(...args) {
        latestArgs = args;
        if (paused)
            return;
        paused = true;
        window.setTimeout(() => {
            fn.apply(this, latestArgs);
            paused = false;
        }, waitTime);
    };
};
export default throttle;
//# sourceMappingURL=throttle.js.map