Open History to see the last commit
function parseKeyboardEvent(event, platform?): ParsedHotkeyChord;
Defined in: parse.ts:308
Parses a KeyboardEvent into the chord it pressed, in the same format as
parseHotkey(). Pass the result to normalizeHotkey for its canonical string.
Parameters#
event#
KeyboardEvent
The KeyboardEvent to parse
platform?#
Platform
The target platform for resolving modifiers (defaults to auto-detection)
Returns#
The parsed chord for the keyboard event
Example#
document.addEventListener('keydown', (event) => {
const parsed = parseKeyboardEvent(event)
console.log(parsed) // { key: 'S', ctrl: true, shift: false, ... }
})