blockly > ShortcutRegistry > KeyboardShortcut > preconditionFn

ShortcutRegistry.KeyboardShortcut.preconditionFn property

A function to be called when the shortcut is invoked, before calling callback, to decide if this shortcut is applicable in the current situation.

Signature:

preconditionFn?: (workspace: WorkspaceSvg, scope: Scope) => boolean;