Private
_commandPrivate
_commandPrivate
_commandsPrivate
_exactPrivate
_holdPrivate
_keyPrivate
_keyPrivate
_keydownPrivate
_keystrokesPrivate
_replayingPrivate
_timerIDPrivate
_timerA signal emitted when a command has changed.
This signal is useful for visual representations of commands which need to refresh when the state of a relevant command has changed.
A signal emitted when a command has executed.
Care should be taken when consuming this signal. The command system is used by many components for many user actions. Handlers registered with this signal must return quickly to ensure the overall application remains responsive.
A signal emitted when a key binding is changed.
A read-only array of the key bindings in the registry.
Private
_clearPrivate
_clearPrivate
_clearPrivate
_executeExecute the command for the given key binding.
If the command is missing or disabled, a warning will be logged.
The execution will not proceed if any of the events leading to the keybinding matching were held with the permission resolving to false.
Private
_onPrivate
_replayPrivate
_startStart or restart the timeout on the modifier keys.
This timeout will end only if the keys are hold.
Private
_startAdd a command to the registry.
The unique id of the command.
The options for the command.
A disposable which will remove the command.
An error if the given id
is already registered.
Add a key binding to the registry.
The options for creating the key binding.
A disposable which removes the added key binding.
If multiple key bindings are registered for the same sequence, the binding with the highest selector specificity is executed first. A tie is broken by using the most recently added key binding.
Ambiguous key bindings are resolved with a timeout. As an example,
suppose two key bindings are registered: one with the key sequence
['Ctrl D']
, and another with ['Ctrl D', 'Ctrl W']
. If the user
presses Ctrl D
, the first binding cannot be immediately executed
since the user may intend to complete the chord with Ctrl W
. For
such cases, a timer is used to allow the chord to be completed. If
the chord is not completed before the timeout, the first binding
is executed.
Get the short form caption for a specific command.
The id of the command of interest.
The arguments for the command.
The caption for the command, or an empty string if the command is not registered.
Get the extra class name for a specific command.
The id of the command of interest.
The arguments for the command.
The class name for the command, or an empty string if the command is not registered.
Get the dataset for a specific command.
The id of the command of interest.
The arguments for the command.
The dataset for the command, or an empty dataset if the command is not registered.
Get the description for a specific command.
The id of the command of interest.
The arguments for the command.
The description for the command.
Execute a specific command.
The id of the command of interest.
The arguments for the command.
A promise which resolves with the result of the command.
The promise will reject if the command throws an exception, or if the command is not registered.
Delay the execution of any command matched against the given 'keydown' event
until the permission
to execute is granted.
The event object for a 'keydown'
event.
The promise with value indicating whether to proceed with the execution.
This enables the caller of processKeydownEvent
to asynchronously prevent the
execution of the command based on external events.
Get the icon renderer for a specific command.
DEPRECATED: if set to a string value, the .icon field will function as an alias for the .iconClass field, for backwards compatibility. In the future when this is removed, the default return type will become undefined.
The id of the command of interest.
The arguments for the command.
The icon renderer for the command or undefined
.
Get the icon class for a specific command.
The id of the command of interest.
The arguments for the command.
The icon class for the command, or an empty string if the command is not registered.
Get the icon label for a specific command.
The id of the command of interest.
The arguments for the command.
The icon label for the command, or an empty string if the command is not registered.
Test whether a specific command is enabled.
The id of the command of interest.
The arguments for the command.
A boolean indicating whether the command is enabled,
or false
if the command is not registered.
Test whether a specific command is toggleable.
The id of the command of interest.
The arguments for the command.
A boolean indicating whether the command is toggleable,
or false
if the command is not registered.
Test whether a specific command is toggled.
The id of the command of interest.
The arguments for the command.
A boolean indicating whether the command is toggled,
or false
if the command is not registered.
Test whether a specific command is visible.
The id of the command of interest.
The arguments for the command.
A boolean indicating whether the command is visible,
or false
if the command is not registered.
Get the display label for a specific command.
The id of the command of interest.
The arguments for the command.
The display label for the command, or an empty string if the command is not registered.
Get the mnemonic index for a specific command.
The id of the command of interest.
The arguments for the command.
The mnemonic index for the command, or -1
if the
command is not registered.
Notify listeners that the state of a command has changed.
Optional
id: stringThe id of the command which has changed. If more than one command has changed, this argument should be omitted.
An error if the given id
is not registered.
This method should be called by the command author whenever the application state changes such that the results of the command metadata functions may have changed.
This will cause the commandChanged
signal to be emitted.
Process a 'keydown'
event and invoke a matching key binding.
The event object for a 'keydown'
event.
This should be called in response to a 'keydown'
event in order
to invoke the command for the best matching key binding.
The registry does not install its own listener for 'keydown'
events. This allows the application full control over the nodes
and phase for which the registry processes 'keydown'
events.
When the keydown event is processed, if the event target or any of its
ancestor nodes has a data-lm-suppress-shortcuts
attribute, its keydown
events will not invoke commands.
Process a keyup
event to clear the timer on the modifier, if it exists.
The event object for a 'keydown'
event.
Get the usage help text for a specific command.
The id of the command of interest.
The arguments for the command.
The usage text for the command, or an empty string if the command is not registered.
An object which manages a collection of commands.
Notes
A command registry can be used to populate a variety of action-based widgets, such as command palettes, menus, and toolbars.