{"name":"mousetrap","version":"0.0.1","description":"Keyboard shortcuts component (browser)","main":"mousetrap.js","repository":{"type":"git","url":"git://github.com/component/mousetrap.git"},"keywords":["keyboard","component","shortcuts"],"component":{"scripts":{"mousetrap":"mousetrap.js"}},"_id":"mousetrap@0.0.1","dist":{"shasum":"7d3ef6ecfa00761054fe36bda68d0f6cea16058b","tarball":"http://registry-npm.ywwl.com/mousetrap/download/mousetrap-0.0.1.tgz","integrity":"sha512-8EJXdpjPCcE3q+PFctvZKQlGLb7F25dPWNezh6Q62z25EbI9ISv56M4ummeqfTdZOpKczXBnLmgjUVFa3iV2YQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFVcNHF3SfJZ037a7TdJnfcMuzUmc0+NuRLnm4Pl5hXPAiA8xfT2sD7DDoSjPewpfRQs9aZUH2LKWAOG54pp9dIaNg=="}],"size":45068,"noattachment":false,"key":"/mousetrap/-/mousetrap-0.0.1.tgz"},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"directories":{},"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":1343844137353,"_cnpm_publish_time":1343844137353,"dist-tags":{"latest":"1.6.5"}}