Home > blockly > ShortcutRegistry > KeyboardShortcut
ShortcutRegistry.KeyboardShortcut interface
Interface defining a keyboard shortcut.
Signature:
interface KeyboardShortcut
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| allowCollision? | boolean | (Optional) Value of allowCollision to pass to addKeyMapping when binding this shortcut's .keyCodes (if any). N.B.: this is only used for binding keycodes at the time this shortcut is initially registered, not for any subsequent addKeyMapping calls that happen to reference this shortcut's name. | |
| callback? | (workspace: WorkspaceSvg, e: Event, shortcut: KeyboardShortcut, scope: Scope) => boolean | (Optional) The function to be called when the shorctut is invoked. | |
| keyCodes? | (number | string)[] | (Optional) Optional list of key codes to be bound (via ShortcutRegistry.prototype.addKeyMapping) to this shortcut. | |
| metadata? | object | (Optional) Optional arbitray extra data attached to the shortcut. | |
| name | string | The name of the shortcut. Should be unique. | |
| preconditionFn? | (workspace: WorkspaceSvg, scope: Scope) => boolean | (Optional) A function to be called when the shortcut is invoked, before calling callback, to decide if this shortcut is applicable in the current situation. |