Backbone.Shortcuts
Backbone.js + Keymaster.js = Backbone.Shortcuts.
Downloads
- Development Version 1.031 kb, full source code
- Production Version 0.577 kb, packed and gzipped
Dependencies
- Underscore.js ~> 1.3.1 for
_.extend()
function - Backbone.js ~> 0.9.1 for
Backbone
class - Keymaster.js ~> 1.0.2 for keyboard shortcuts functionality
Usage
HTML
Place snippets inside of the <head>...</head>
tags.
JavaScript
var ShortcutKeys = BackboneShortcuts; var shortcuts = ;
CoffeeScript
shortcuts: "ctrl+r" : "reloadPage" : -> alert "Reload!!!" shortcuts =
Finally, you can press Ctrl + r
to execute reloadPage()
function to see the alert message.
Use Backbone.Shortcuts as Delegation for your Backbone.View
You have to _.extend
the this
as desination and new Backbone.Shortcuts
as source then finally call the delegate function this.delegateShortcuts();
.
Author
Bryan Goines, @bryangoines
License
Backbone.Shortcuts is licensed under MIT license.