In Backbone Marionette, you can do extremely similar things with triggers and events:
triggers:
return Marionette.Layout.extend({
triggers: {
'click .something': 'view:handleClickSomething'
},
initialize: function(){
this.bindTo(this, 'view:handleClickSomething', this.handleClickSomething);
},
handleClickSomething: function(){}
}
vs. events:
return Marionette.Layout.extend({
events: {
'click .something': 'view:handleClickSomething'
},
handleClickSomething: function(ev){}
}
The events way seems like a quicker easier way and also makes it easier to get at the actual event itself (since it is passed in automatically). Is there a reason to use one over the other? What are their intended use cases? Having trouble finding much info about this online (other than trying to grok the annotated source)...
(I only just discovered the events method, and up until now have been using triggers for everything since I thought that was the only way)