Keymaster is a simple micro-library for defining and dispatching keyboard shortcuts in web applications. It has no dependencies. It’s a work in progress (e.g. beta), so spare me your nerdrage and instead contribute! Patches are welcome, but they are not guaranteed to make it in. Include keymaster.js in your web app*, by loading it as usual. Keymaster has no dependencies and can be used completely standalone. It should not interfere with any JavaScript libraries or frameworks. *Preferably use a minified version that fits your workflow. You can run make to have UglifyJS (if you have it installed) create a keymaster.min.js file for you. At any point in time (even in code other than key shortcut handlers), you can query the key object for the state of any keys. This allows easy implementation of things like shift+click handlers. For example, key.shift is true if the shift key is currently pressed.
Features
- noConflict mode
- Unbinding shortcuts
- Filter key presses
- Modifier key queries
- It has no dependencies
- Keymaster supports switching between scopes