in src/shortcuts/core.ts [79:107]
bind(params: ShortcutsParams) {
if (!(params instanceof Object) || typeof params.handler !== 'function') {
throw new Error('Shortcut handler should exist');
}
if (!params.scope) {
params.scope = this.ROOT_SCOPE.scopeId;
}
if (Array.isArray(params.key)) {
for (let i = 0; i < params.key.length; i++) {
this.bind(Object.assign({}, params, {key: params.key[i]}));
}
return;
}
if (typeof params.key !== 'string') {
throw new Error('Shortcut key should exist');
}
let scope = this._scopes[params.scope];
if (!scope) {
scope = this._scopes[params.scope] = {};
}
scope[params.key] = params.handler;
this.combokeys.bind(params.key, this._dispatcher, this._getKeyboardEventType(params));
}