gnome/extensions/dash-to-dock@micxgx.gmail.com/utils.js
/**
 * Convert a signal handler with n value parameters (that is, excluding the
 * signal source parameter) to an array of n handlers that are each responsible
 * for receiving one of the n values and calling the original handler with the
 * most up-to-date arguments.
 */
Convert a signal handler with n value parameters (that is, excluding the
signal source parameter) to an array of n handlers that are each responsible
for receiving one of the n values and calling the original handler with the
most up-to-date arguments.
Convert a signal handler with n value parameters ( that is excluding the signal source parameter ) to an array of n handlers that are each responsible for receiving one of the n values and calling the original handler with the most up - to - date arguments .
function splitHandler(handler) {
    if (handler.length > 30) {
        throw new Error("too many parameters");
    }
    const count = handler.length - 1;
    let missingValueBits = (1 << count) - 1;
    const values = Array.from({ length: count });
    return values.map((_ignored, i) => {
        const mask = ~(1 << i);
        return (obj, value) => {
            values[i] = value;
            missingValueBits &= mask;
            if (missingValueBits === 0) {
                handler(obj, ...values);
            }
        };
    });
}
function splitHandler ( handler ) { if ( handler . length > 30 ) { throw new Error ( "too many parameters" ) ; } const count = handler . length - 1 ; let missingValueBits = ( 1 << count ) - 1 ; const values = Array . from ( { length : count } ) ; return values . map ( ( _ignored , i ) => { const mask = ~ ( 1 << i ) ; return ( obj , value ) => { values [ i ] = value ; missingValueBits &= mask ; if ( missingValueBits === 0 ) { handler ( obj , ... values ) ; } } ; } ) ; }
Convert a signal handler with n value parameters (that is, excluding the
 signal source parameter) to an array of n handlers that are each responsible
 for receiving one of the n values and calling the original handler with the
 most up-to-date arguments.
Convert a signal handler with n value parameters ( that is excluding the signal source parameter ) to an array of n handlers that are each responsible for receiving one of the n values and calling the original handler with the most up - to - date arguments .