function createHotkeyChordHandler(
chord,
callback,
options?): (event) => void;Defined in: match.ts:91
Creates a keyboard event handler that calls the callback when the chord matches. For sequences, use createSequenceMatcher.
| HotkeyChord | ParsedHotkeyChord
The chord string or parsed chord to match
HotkeyCallback<HotkeyChordCallbackContext>
The function to call when the hotkey matches
CreateHotkeyChordHandlerOptions = {}
Options for matching and handling
A function that can be used as an event handler
(event) => void
const handler = createHotkeyChordHandler('Mod+S', (event, { hotkey, parsedChord }) => {
console.log(`${hotkey} was pressed`)
handleSave()
})
document.addEventListener('keydown', handler)