Skip to content

massa-org/fluent-hotkey-builder

Repository files navigation

Fluent hotkey builder

Builder for generate typesafe hotkey context that allow to bind keystroke to action

Implement as builder to allow generate hotkey context for platforms with different keycodes

  • web browsers
  • system wide keybindings for node/bun

Hotkey context split from keyPressHandler implementation cause it allow to implement keyPressHandler for multiple different scopes

Examples in svelte

ex. bind hotkeys to focused html element

<input use:handleHotkey={context().add((h) => h.enter.bind(search))} />

ex. bind to interactive element

<button use:hotkey={(h) => h.enter}>Search</button>
<input use:hotkey={(h) => h.control.keyK}>Search box</input>

Example

const hotkeys = context()
    .add((h) => h.alt.keyH.bind(() => console.log('hello world')))
    .add((h) => h.alt.f4.bind(() => console.log('goodbye')))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published