Scope
A scope receives keyboard events and binds callbacks to given hotkeys. Only one scope is active at a time, but scopes may define parent scopes (in the constructor) and inherit their hotkeys.
Constructors
new Scope()
new Scope(
parent
?):Scope
Parameters
• parent?: Scope
Returns
Properties
keys
keys:
KeyScope
[]
Overridden keys that exist in this scope
Methods
register()
register(
modifiers
,key
,func
):KeymapEventHandler
Add a keymap event handler to this scope.
Parameters
• modifiers: null
| Modifier
[]
Mod
, Ctrl
, Meta
, Shift
, or Alt
. Mod
translates to Meta
on macOS and Ctrl
otherwise. Pass null
to capture all events matching the key
, regardless of modifiers.
• key: null
| string
Keycode from https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key%5FValues
• func: KeymapEventListener
the callback that will be called when a user triggers the keybind.
Returns
unregister()
unregister(
handler
):void
Remove an existing keymap event handler.
Parameters
• handler: KeymapEventHandler
Returns
void