Skip to main content
cngx-src documentation

createPaletteKeybinding

Functionui/command-palettev0.1.0

projects/ui/command-palette/palette/palette-keybinding.ts

Description#

Default palette keybinding: installs a document keydown listener that calls onOpen whenever the combo is pressed (matched via matchesKeyCombo). Side-effectful by design - it owns the global listener - so its teardown must be called on destroy.

isMac defaults to platform detection; pass it explicitly for deterministic tests.

Signature#

createPaletteKeybinding(combo: KeyCombo, onOpen, isMac: boolean)

Parameters#

@paramcomboKeyCombo
@paramonOpen
@paramisMacboolean= detectMac()

Returns#

CngxPaletteKeybinding