keypress-tool
Usage
import KeyPress from 'keypress-tool';
KeyPress('A', 'ctrl') === KeyPress('A', 'ctrl');
KeyPress('A', 'ctrl') === KeyPress('A', 'ctrl', 'shift');
KeyPress('A', 'shift').addListener(ev => {
console.log('Key combination pressed');
});
KeyPress('A', 'meta').addListener(handleEvent, true);
function handleEvent(event) {
console.log('Key combination pressed');
}
KeyPress('A', 'meta').removeListener(handleEvent);
KeyPress('A', 'executeDefault');
let k = KeyPress('A', 'ctrl', 'shift', 'alt', 'meta');
k.toString();
k.toString();
Only these special keys work in fullscreen in Safari:
Tab, Enter, Space, Left, Up, Right, Down, ; = , - . / ` [ ] '
See also:
Contributing
Download source and compile:
git clone git@github.com:JannesMeyer/keypress-tool.git
yarn
Or compile and watch for file changes:
yarn start
Run tests:
yarn test
Pull requests welcome. Please respect the existing formatting and indentation style. Furthermore, please add tests for code that you contribute.
License
LGPL v3.0