Skip to main content

HotkeyCallback

还没翻译译自英文(tanstack.com)本页 13 段都还没译

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)
}