Skip to content

Maps key combinations to event names used by the event aggregator of your choice.

License

Notifications You must be signed in to change notification settings

LVsam/Backbone.Commander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Backbone.Commander

Maps key combinations to event names used by the event aggregator of your choice.

#How to Use

By default, Backbone.Commander uses App.vent with the method "trigger" for firing events.

######When your App is initialized

var eventMap = {
  "ctrl+k": "eventName:one",
  "ctrl+alt+y": "eventName:two",
  "shift+up": "eventName:three"
};

new Backbone.Commander(eventMap);

######Within your views & layouts

this.bindTo(App.vent, "eventName:one", this.function, this);

######With a custom event aggregator

var vent = _.clone(Backbone.Events),
    eventMap = {
      "ctrl+k": "eventName:one",
      "ctrl+alt+y": "eventName:two",
      "shift+up": "eventName:three"
    };

new Backbone.Commander(eventMap, {
  method: vent,
  trigger: "trigger"
});

About

Maps key combinations to event names used by the event aggregator of your choice.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages