I have a generic subclass of Backbone.View
which has a close
event listener.
var GenericView = Backbone.View.extend({
events
Another option is to have a BaseView that overrides the implementation of Extend. Such as:
var BaseView = Backbone.View.extend({
//base view functionality if needed
});
BaseView.extend = function(child){
var view = Backbone.View.extend.apply(this, arguments);
view.prototype.events = _.extend({}, this.prototype.events, child.events);
return view;
};
This will automatically extend all of your events for anything that inherits from the BaseView.