An open API service indexing awesome lists of open source software.

https://github.com/auracletech/hotkeys

hotkeys module in TypeScript for hotkeys
https://github.com/auracletech/hotkeys

Last synced: 12 months ago
JSON representation

hotkeys module in TypeScript for hotkeys

Awesome Lists containing this project

README

          

# hotkeys

hotkeys module in TypeScript for easy to add hotkeys

##### Example

![Example](example.png)

##### Requirements

- get `hotkeys.scss` and `hotkeys.ts`

##### Usage

initialization

```typescript
import "../SCSS/hotkeys.scss";
import { Hotkeys } from "./hotkeys.ts";

const hotkeys = new Hotkeys();
```

create a hotkey

```typescript
hotkeys.set({
key: "h",
short: "Toggle Hotkeys",
long: "Toggle the hotkeys modal display",
func: () => hotkeys.toggle_modal(),
experimental: false,
});
```

remove a hotkey

```typescript
hotkeys.remove("h");
```

print keys names available

```typescript
for (const row of Hotkeys.KEYBOARD_KEYS) {
for (const column of row) {
console.log(column);
}
}
```