https://github.com/huang2002/hkeyboard
A keyboard lib.
https://github.com/huang2002/hkeyboard
3h binding key keybinding keyboard keymap map
Last synced: 11 months ago
JSON representation
A keyboard lib.
- Host: GitHub
- URL: https://github.com/huang2002/hkeyboard
- Owner: huang2002
- License: mit
- Created: 2018-08-29T13:59:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-11T15:21:16.000Z (about 7 years ago)
- Last Synced: 2025-02-16T00:32:13.519Z (12 months ago)
- Topics: 3h, binding, key, keybinding, keyboard, keymap, map
- Language: TypeScript
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# hkeyboard
A keyboard lib.
# Usage
```js
// Use as an ES module:
import * as HKB from "hkeyboard";
// or a UMD module:
const HKB = window.HKB;
// Create a keyboard:
const keyboard = new HKB.Keyboard({
// Automatic listening options:
target: window,
options: {},
// Other options...
});
// Subscribe to shortcuts:
keyboard.on('Esc', () => {
// ...
}).on('Control+D', () => {
// ...
}).on('ctrl+shift+l', () => {
// ...
}).on('ctrl+shift+alt+left', () => {
// ...
}).on('ctrl+c alt+d', () => {
// ...
});
// Start listening manually:
keyboard.listenOn(window);
```
# APIs
Please read the declaration files in `typings` folder or the source files in `src` folder to learn the APIs.
# Changelog
See [CHANGELOG.md](CHANGELOG.md)