src/KeyManager.js
/**
 * Updated key bindings if attributes have changed.
 */
Updated key bindings if attributes have changed.
Updated key bindings if attributes have changed .
function update() {
    this.mousetrap.reset();
    if (!this.enabled) return;
    for (var key_id in this.assigned_keys) {
        var assigned_key = this.assigned_keys[key_id];
        if (!assigned_key.key) continue;
        var key_to_bind = _add_cmd(assigned_key.key, this.ctrl_equals_cmd);
        assigned_key.input_list = this.input_list;
        this.mousetrap.bind(key_to_bind, function(e) {
            let input_blocking = false
            if (this.ignore_with_input) {
                for (var i = 0, l = this.input_list.length; i < l; i++) {
                    const thisInputVal = this.input_list[i]
                    const thisInput = _.isFunction(thisInputVal)
                      ? thisInputVal()
                      : thisInputVal
                    if (thisInput !== null && thisInput.is_visible()) {
                        input_blocking = true
                        break
                    }
                }
            }
            if (!input_blocking) {
                if (this.fn) this.fn.call(this.target);
                else console.warn('No function for key: ' + this.key);
                e.preventDefault();
            }
        }.bind(assigned_key), 'keydown');
    }
}
function update ( ) { this . mousetrap . reset ( ) ; if ( ! this . enabled ) return ; for ( var key_id in this . assigned_keys ) { var assigned_key = this . assigned_keys [ key_id ] ; if ( ! assigned_key . key ) continue ; var key_to_bind = _add_cmd ( assigned_key . key , this . ctrl_equals_cmd ) ; assigned_key . input_list = this . input_list ; this . mousetrap . bind ( key_to_bind , function ( e ) { let input_blocking = false if ( this . ignore_with_input ) { for ( var i = 0 , l = this . input_list . length ; i < l ; i ++ ) { const thisInputVal = this . input_list [ i ] const thisInput = _ . isFunction ( thisInputVal ) ? thisInputVal ( ) : thisInputVal if ( thisInput !== null && thisInput . is_visible ( ) ) { input_blocking = true break } } } if ( ! input_blocking ) { if ( this . fn ) this . fn . call ( this . target ) ; else console . warn ( 'No function for key: ' + this . key ) ; e . preventDefault ( ) ; } } . bind ( assigned_key ) , 'keydown' ) ; } }
Updated key bindings if attributes have changed.
Updated key bindings if attributes have changed .
// loop through keys // OK if this is missing // remember the input_list // check inputs