My team was already invested in using this.options
in certain instances, and I didn't want to go through and modify the initialize
method for every subclass of Backbone.View. As soon as Backbone is loaded, we override the Backbone.View constructor
similiar to McGarnagle's answer, but with seamless integration:
// Compatibility override - Backbone 1.1 got rid of the 'options' binding
// automatically to views in the constructor - we need to keep that.
Backbone.View = (function(View) {
return View.extend({
constructor: function(options) {
this.options = options || {};
View.apply(this, arguments);
}
});
})(Backbone.View);