Skip to main content

HotkeyCallback

type HotkeyCallback = (event, context) => void;

Defined in: hotkey.types.ts:233

Callback function type for hotkey handlers.

Parameters

event

KeyboardEvent

The keyboard event that triggered the hotkey

context

HotkeyCallbackContext

Additional context including the hotkey and parsed hotkey

Returns

void

Example

const handler: HotkeyCallback = (event, { hotkey, parsedHotkey }) => {
  console.log(`Hotkey ${hotkey} was pressed`)
  console.log(`Modifiers:`, parsedHotkey.modifiers)
}