Beta
Bind a command to a specific key combination to add it to the registry
Will throw an error if the command is invalid or not registered
the string representation of keys
the command to trigger when keys are pressed
Get a list of the key bindings that are currently in the registry
the list of command and its specific key combination
Checks if a key combination or a specific keybinding is already bound
true if key combination already exists, else false
the string representation of a key combination
Optional
command: objectthe command connected to the key combination
Unbind a keybinding to remove it from the registry
the string representation of the key combination
the command connected to the key combination
Service for binding keyboard shortcuts to execute commands
A keybinding is a sequence or key combination on a computer keyboard which invokes commands. This service supports key bindings as a way of responding to individual keys typed by a user. The key combination can be pressing a single key or a sequence of keys one after the other.
The service works together with the
CommandBus
to execute the commands and a command needs to already be registered on the command bus in order to be bound as a keyboard shortcut.The following example registers the command
MyCommand
to be handled byMyHandler
and creates a keybinding for it. Thebind
method takes the key combination and command object as input.Later, if the keybinding no longer is needed it can be removed with the
unbind
method.Example
Note
This service is work in progress