ShortcutManager
The ShortcutManager
API allows developers to register keyboard shortcuts for specified actions using JS or TS.
Basic Example
main.js
Methods
registerShortcut
Allows developers to register a new keyboard shortcut, and specify the corresponding action (via a callback function). The key combination (keys
parameter) for a shortcut is the shortcut's unique identifier, hence if duplicate shortcuts are registered, only the last registered callback action will execute.
Parameter
Type
Example
keys
string
"CTRL+K"
callback
Function
Reserved keys
The following keys are reserved and hence cannot be used as keys
:
CTRL+Z
CTRL+SHIFT+Z
CTRL+Y
CTRL+C
CTRL+V
CTRL+R
ESC
ENTER
BACKSPACE
DELETE
unregisterShortcut
Allows developers to unregister a previously registered keyboard shortcut.
Parameter
Type
Example
keys
string
"CTRL+K"
Last updated