Methods
bind Action(action Id, key Shortcut)
Bind an action to a keyboard shortcut. This method will typically be used by the app code.
Parameters:
Name | Type | Description |
---|---|---|
actionId |
String | Action to bind. |
keyShortcut |
String | Array | Refer to Mousetrap's documentation to see what keys are supported. |
get Action(action Id) → {undefined|Object}
Get the information about a registered action.
Parameters:
Name | Type | Description |
---|---|---|
actionId |
String | Action to return. |
Returns:
- Type
- undefined | Object
register Action(action Id, action Cb)
Register an action that can then be bound to a shortcut key. This method will typically be used by a component that wishes to provide some functionality that will be invoked with a keyboard shortcut.
Parameters:
Name | Type | Description |
---|---|---|
actionId |
String | A unique string ID of the action. It is recommended that the ID is prefixed with the namespace of the component. |
actionCb |
function | The function that will be invoked for this action. |
Throws:
-
If trying to add an action that was already added.
- Type
-
module:br
/Errors#Invalid Parameters Error
remove Action(action Id)
Remove the action.
Parameters:
Name | Type | Description |
---|---|---|
actionId |
String |
Throws:
-
If trying to remove a non existing action.
- Type
-
module:br
/Errors#Invalid Parameters Error
unbind Action(action Id)
Unbind an action from a keyboard shortcut. The action will not be removed. To remove it completely removeAction
should be used.
Parameters:
Name | Type | Description |
---|---|---|
actionId |
String | Action to remove. |