/**
 * Returns a function wrapper that will only call the passed function once
 *
 * Important - the passed function should not throw or reject
 */
export function debounce(func, wait) {
    let timeout;
    const output = function () {
        const later = function () {
            timeout = undefined;
            void func();
        };
        clearTimeout(timeout);
        timeout = setTimeout(later, wait);
    };
    output.start = () => { };
    output.stop = () => {
        clearTimeout(timeout);
    };
    return output;
}
//# sourceMappingURL=utils.js.map