@hotkeys/manager
v0.0.1
Published
A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
Downloads
25
Maintainers
Readme
Hotkeys
This is the fork of [[hotkeys-js|https://www.npmjs.com/package/hotkeys-js]]
Install
Install from npm
npm i --save @hotkeys/manager
Import to file:
import hotkeysManager from '@hotkeys/manager';
Changes
addCustomKeyMap
// update keyName => keyCode map
hotkeysManager.addCustomKeyMap({
"numPad#1": 97,
"numPad#2": 98,
"numPad#3": 99,
"=>": 39, 'arrow right'
});
// use new keys in shotcuts
hotkeysManager('ctrl+numPad#1+=>', () => console.log('hotkey pressed!'));
Bind by key codes
// bind just with key codes
hotkeysManager([18, 97, 39], () => console.log('hotkey pressed!'));
// unbind
hotkeysManager.unbind([18, 97, 39]);