keypress-handler
Handler for javascript keyboard events
Info
Handler for keyboard events in JS. Wich DOESN'T have debounce time when triggered.
Legacy event handling
document;
kh;
kh;
Install
npm install --save keypress-handler
Usage
Works with either JS or TS (typings included).
Example below provided in React but you can ues any other framework
kh.runinterval;
- runs the watcher
- interval (number, optional, 100 - default) - value in ms stands for interval how often en event is fired.
kh.onKeykeyCode, handler, options;
- creates watcher for certain key
- keyCode (number|string, required)- js keycode for a key https://keycode.info/
- handler (function, required) - handler function for an event
- options (object, optional) - configuration options for a watcher
- hold (boolean) - true if needed even firing on hold, false - ONLY 1 event is fired
kh;
- stops handling events
Example
; ;
License
MIT © SergeOlabin