key-selector
v1.1.0
Published
Allow selection of a key sequence in a text box
Downloads
12
Readme
KeySelector
Displays a sequence of combined key commands (ctrl
, shift
, alt
, or
win
and regular keys) for the potential use as a hot-key selector.
Installation
npm install key-selector
Usage
Browser
<script src="node_modules/key-selector/KeySelector.js"></script>
and in your code, use:
KeySelector.addListeners(input);
...where input
is an HTML input element to which to add the key command listeners.
The input
's value will be equal to the commands separated by +
, such as:
- alt-7
- ctrl-s
- ctrl-alt-c
- shift-ctrl-k
- shift-alt-V
- shift-ctrl-alt-V
Other Common.js environments:
var KeySelector = require('key-selector');
KeySelector.addListeners(input);
Todos
- More precisely detect and streamline a format for keys such as "enter"?