Skip to content

Scope

Defined in: obsidian.d.ts:3563

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

Defined in: obsidian.d.ts:3568

Parameters

parent?

Scope

Returns

Scope

Properties

keys

keys: KeyScope[]

Defined in: src/obsidian/augmentations/Scope.d.ts:12

Overridden keys that exist in this scope

Methods

register()

register(modifiers, key, func): KeymapEventHandler

Defined in: obsidian.d.ts:3576

Add a keymap event handler to this scope.

Parameters

modifiers

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.

null | Modifier[]

key

Keycode from https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key%5FValues

null | string

func

KeymapEventListener

the callback that will be called when a user triggers the keybind.

Returns

KeymapEventHandler


unregister()

unregister(handler): void

Defined in: obsidian.d.ts:3581

Remove an existing keymap event handler.

Parameters

handler

KeymapEventHandler

Returns

void