hotkeys
Minified3.20 KBMinzipped1.30 KBHighly flexible keyboard shortcut management for any environment.
Example
ts
import { Hotkeys } from "@monstermann/hotkeys";
Hotkeys.bind("ctrl+a", () => {});
document.addEventListener("keypress", (event) => {
const hotkeys = Hotkeys.evt(event);
for (const binding of Hotkeys.bindings) {
if (Hotkeys.isExactMatch(binding.hotkeys, hotkeys)) binding.callback();
}
});Installation
sh
npm install @monstermann/hotkeyssh
pnpm add @monstermann/hotkeyssh
yarn add @monstermann/hotkeyssh
bun add @monstermann/hotkeys