Interface RecordedKeyboardEvent

Keys pressed and released on the keyboard.

  • note: Pressing/releasing input modifiers (like shift, option, command, etc) are not captured by this event, but through ModifiersChangedEvent.
interface RecordedKeyboardEvent {
    type: "keyboard";
    keyboardEventType: KeyboardEventType;
    time: EventTime;
    modifiers: InputModifier[];
    keyType: KeyboardKeyType;
    keyTitle: string;
    keySymbol: string;
    characters?: string;
    isARepeat: boolean;
}

Properties

type: "keyboard"

Discriminator marking this as a keyboard event.

keyboardEventType: KeyboardEventType

Type of keyboard event this is.

time: EventTime

Time the event occurred in the recording.

modifiers: InputModifier[]

Input modifier keys (like shift, option, command, etc) pressed during this event.

Possible values will appear at most once, no duplicate values will be present.

Classifies the key as a regular character key or one of the recognised special keys (escape, arrows, function keys, etc) without needing to inspect raw keycodes. See KeyboardKeyType.

keyTitle: string

A short human-readable label for the key (e.g. "esc", "return", "left", "F1"). Character keys carry the produced character, uppercased (e.g. "A", "1", "/"); the placeholder "□" is used only as a fallback when the character cannot be determined.

keySymbol: string

A single-glyph symbol for the key (e.g. "⎋", "⏎", "←", "⌫"). Function keys fall back to their label ("F1"); character keys carry the produced character, uppercased, with "□" as the fallback when it cannot be determined.

characters?: string

The character(s) the key press produced, if any.

Reflects the actual typed text after applying the active keyboard layout and modifiers (so e.g. shift yields a capital). Absent for keys that don't generate characters.

isARepeat: boolean

Whether the key event is a repeat.

Repeats happen when the user holds the key down for a longer period of time and the system starts repeating the same key press over and over again.

Generated using TypeDoc