hotkeys module in TypeScript for easy to add hotkeys
- get
hotkeys.scss
andhotkeys.ts
initialization
import "../SCSS/hotkeys.scss";
import { Hotkeys } from "./hotkeys.ts";
const hotkeys = new Hotkeys();
create a hotkey
hotkeys.set({
key: "h",
short: "Toggle Hotkeys",
long: "Toggle the hotkeys modal display",
func: () => hotkeys.toggle_modal(),
experimental: false,
});
remove a hotkey
hotkeys.remove("h");
print keys names available
for (const row of Hotkeys.KEYBOARD_KEYS) {
for (const column of row) {
console.log(column);
}
}