https://github.com/closeio/backbone.mousetrap
A better integration of Backbone.js and Mousetrap keyboard event bindings
https://github.com/closeio/backbone.mousetrap
Last synced: 4 months ago
JSON representation
A better integration of Backbone.js and Mousetrap keyboard event bindings
- Host: GitHub
- URL: https://github.com/closeio/backbone.mousetrap
- Owner: closeio
- Created: 2012-10-16T05:52:19.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2017-02-17T00:04:21.000Z (over 9 years ago)
- Last Synced: 2025-08-04T11:23:20.764Z (11 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 59
- Watchers: 27
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
backbone.mousetrap
==================
Bring [Backbone.js](http://backbonejs.org/) and [Mousetrap](https://github.com/ccampbell/mousetrap) together nicely for declarative keyboard event bindings on Backbone views.
* Nice declarative syntax
* Allows you to bind different keyboard events to different views
* Keyboard events are unbound automatically when the view's `remove()` is called
```js
var View = Backbone.View.extend({
keyboardEvents: {
'command+shift+t': 'test',
'control+shift+t': 'test'
},
test: function(ev) {
alert('hello world!');
}
});
```
MIT LICENSE
---
Thanks to our friends at Codecademy for showing us the declarative light with [backbone.declarative](https://github.com/Codecademy/backbone.declarative).