backbone.mousetrap

1.0.0 • Public • Published

backbone.mousetrap

Bring Backbone.js and 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
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.

/backbone.mousetrap/

    Package Sidebar

    Install

    npm i backbone.mousetrap

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • krishanmarco
    • marco.tisi
    • schiavi-close
    • treyatclose
    • taylorbrooks
    • philfreo
    • buzinas
    • bgryszko
    • lukasmlady