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:

Parameter Type Description
modifiers Modifier[] | null 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 string | null 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: KeymapEventHandler