src/main/util/debounce.js
function debounce(callback) {
    let timeout = null;

    return () => {
        if (timeout !== null) {
            return;
        }

        timeout = setTimeout(() => {
            timeout = null;
            callback();
        }, 0);
    }
}
function debounce(callback) {
    let timeout = null;

    return () => {
        if (timeout !== null) {
            return;
        }

        timeout = setTimeout(() => {
            timeout = null;
            callback();
        }, 0);
    }
}
function debounce ( callback ) { let timeout = null ; return ( ) => { if ( timeout !== null ) { return ; } timeout = setTimeout ( ( ) => { timeout = null ; callback ( ) ; } , 0 ) ; } }
Wrap a function so that multiple calls result in a single invocation on the next event loop tick. This function
cannot accept arguments or return a value.

@param {function()} callback - Function to be wrapped.
@returns {function()} Wrapped function.
Wrap a function so that multiple calls result in a single invocation on the next event loop tick . This function cannot accept arguments or return a value .