Readonly
conditionReadonly
descriptionA description of what the command does.
Optional
Readonly
executeThe function to execute when a shortcut triggers it's command. It is executed both on keydown and keyup (of the first released key) so be sure to check the isKeydown parameter so you don't trigger commands twice.
The command itself is passed to it, and if it is managed by a manager it is also passed the shortcut, the manager itself, and the event of the last key that triggered it. Note the event might not exist when the manager needs to emulate a key release. See Manager.autoReleaseDelay.
You should do e.preventDefault
if you need it or haven't done so from Manager.eventFilter.
You should also do safeSetManagerChain on keyup for most regular shortcuts. See it for details.
See Manager.
Readonly
nameUnique string to identify the command by.
Note that when changing a command's name, it is not an error for the old command to not exist in the manager. This is to allow for easier checking if a command can be added. If you need it to be an error, you can add a canSetCommand hook.
Readonly
type
Commands may have an additional condition that must be met, apart from the shortcut's that triggered it.
If the command is created without a condition, it is assigned a blank condition. If you are using a custom condition class, you should probably always pass a blank condition.