Skip to content

Scope.register method

Scope › register

Official

Add a keymap event handler to this scope.

Signature:

register(modifiers: Modifier[] | null, key: string | null, func: KeymapEventListener): KeymapEventHandler

Parameters:

ParameterTypeDescription
modifiersModifier[] | nullMod, 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.
keystring | nullKeycode from https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key%5FValues
funcKeymapEventListenerthe callback that will be called when a user triggers the keybind.

Returns: KeymapEventHandler