{"name":"mousetrap","version":"1.5.3","description":"Simple library for handling keyboard shortcuts","main":"mousetrap.js","directories":{"test":"tests"},"scripts":{"test":"grunt mocha"},"repository":{"type":"git","url":"git://github.com/ccampbell/mousetrap.git"},"keywords":["keyboard","shortcuts","events"],"author":{"name":"Craig Campbell"},"license":"Apache 2.0","gitHead":"c202a0bd4967d5a3064f9cb376db51dec9345336","devDependencies":{"grunt":"~0.4.1","grunt-complexity":"~0.1.2","grunt-mocha":"~0.3.1"},"bugs":{"url":"https://github.com/ccampbell/mousetrap/issues"},"homepage":"https://github.com/ccampbell/mousetrap","_id":"mousetrap@1.5.3","dist":{"shasum":"33a900b15184427c4f583e9d9822ee6c3eaf265b","tarball":"http://registry-npm.ywwl.com/mousetrap/download/mousetrap-1.5.3.tgz","integrity":"sha512-QMJ2QYVxqKL6kbxKZgwJyd14KRFcszTIit5e3eia+7qddajiK8hfY8mNBLUZcFhi3uWjD1oH8Td7Rw92/JwxZQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIETdm1epDeSQjCDsmNTWHvCvDJAUg7bTU/mc5ZW7F+BrAiBa3jgneURGsQJeVRck95RJkk12/UIFrYVbw+47+WCTxA=="}],"size":130664,"noattachment":false,"key":"/mousetrap/-/mousetrap-1.5.3.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"ccampbell","email":"iamcraigcampbell@gmail.com"},"maintainers":[{"name":"zeke","email":"zeke@sikelianos.com"},{"name":"ccampbell","email":"iamcraigcampbell@gmail.com"}],"readme":"# Mousetrap\n[![CDNJS](https://img.shields.io/cdnjs/v/mousetrap.svg)](https://cdnjs.com/libraries/mousetrap)\n\nMousetrap is a simple library for handling keyboard shortcuts in Javascript.\n\nIt is licensed under the Apache 2.0 license.\n\nIt is around **2kb** minified and gzipped and **4.5kb** minified, has no external dependencies, and has been tested in the following browsers:\n\n- Internet Explorer 6+\n- Safari\n- Firefox\n- Chrome\n\nIt has support for `keypress`, `keydown`, and `keyup` events on specific keys, keyboard combinations, or key sequences.\n\n## Getting started\n\n1. Include mousetrap on your page before the closing `</body>` tag\n\n    ```html\n    <script src=\"/path/to/mousetrap.min.js\"></script>\n    ```\n\n    or install `mousetrap` from `npm` and require it\n\n    ```js\n    var Mousetrap = require('mousetrap');\n    ```\n\n2. Add some keyboard events to listen for\n\n    ```html\n    <script>\n        // single keys\n        Mousetrap.bind('4', function() { console.log('4'); });\n        Mousetrap.bind(\"?\", function() { console.log('show shortcuts!'); });\n        Mousetrap.bind('esc', function() { console.log('escape'); }, 'keyup');\n\n        // combinations\n        Mousetrap.bind('command+shift+k', function() { console.log('command shift k'); });\n\n        // map multiple combinations to the same callback\n        Mousetrap.bind(['command+k', 'ctrl+k'], function() {\n            console.log('command k or control k');\n\n            // return false to prevent default browser behavior\n            // and stop event from bubbling\n            return false;\n        });\n\n        // gmail style sequences\n        Mousetrap.bind('g i', function() { console.log('go to inbox'); });\n        Mousetrap.bind('* a', function() { console.log('select all'); });\n\n        // konami code!\n        Mousetrap.bind('up up down down left right left right b a enter', function() {\n            console.log('konami code');\n        });\n    </script>\n    ```\n\n## Why Mousetrap?\n\nThere are a number of other similar libraries out there so what makes this one different?\n\n- There are no external dependencies, no framework is required\n- You are not limited to `keydown` events (You can specify `keypress`, `keydown`, or `keyup` or let Mousetrap choose for you).\n- You can bind key events directly to special keys such as `?` or `*` without having to specify `shift+/` or `shift+8` which are not consistent across all keyboards\n- It works with international keyboard layouts\n- You can bind Gmail like key sequences in addition to regular keys and key combinations\n- You can programatically trigger key events with the `trigger()` method\n- It works with the numeric keypad on your keyboard\n- The code is well documented/commented\n\n## Tests\n\nUnit tests are run with <a href=\"https://mochajs.org/\">mocha</a>.\n\n### Running in browser\n\n[View it online](http://rawgit.com/ccampbell/mousetrap/master/tests/mousetrap.html) to check your browser compatibility. You may also download the repo and open `tests/mousetrap.html` in your browser.\n\n### Running with Node.js\n\n1. Install development dependencies\n\n    ```sh\n    cd /path/to/repo\n    npm install\n    ```\n\n3. Run tests\n\n    ```sh\n    npm test\n    ```\n\n## Documentation\n\nFull documentation can be found at https://craig.is/killing/mice\n","publish_time":1435869397767,"_cnpm_publish_time":1435869397767,"dist-tags":{"latest":"1.6.5"}}