0.0.1 • Published 4 years ago

@hotkeys/manager v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

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]);