Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 824 Bytes

File metadata and controls

40 lines (26 loc) · 824 Bytes
id parseKeyboardEvent
title parseKeyboardEvent

Function: parseKeyboardEvent()

function parseKeyboardEvent(event): ParsedHotkey;

Defined in: parse.ts:216

Parses a KeyboardEvent into a ParsedHotkey object.

This function extracts the key and modifier state from a keyboard event and converts it into the same format used by parseHotkey().

Parameters

event

KeyboardEvent

The KeyboardEvent to parse

Returns

ParsedHotkey

A ParsedHotkey object representing the keyboard event

Example

document.addEventListener('keydown', (event) => {
  const parsed = parseKeyboardEvent(event)
  console.log(parsed) // { key: 'S', ctrl: true, shift: false, ... }
})