Skip to main content

Function: heldModifiers()

heldModifiers(event, platform?): KeyCombo

Defined in: src/lib/utils/shortcuts/index.ts:576

The modifier keys held during a key press, as a key combination without a key (e.g. to show them while recording a key combination). Read like comboFromEvent: cmd is Command on Apple devices and Ctrl elsewhere.

Parameters​

event​

KeyEventLike

platform?​

string

Returns​

KeyCombo

Example​

heldModifiers({ key: "Shift", metaKey: true, ctrlKey: false, shiftKey: true, altKey: false }, "MacIntel");
// { key: "", cmd: true, shift: true }