You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...
var appleView = Backbone.View.extend({
this.model = new (Backbone.Model.extend({}));
this.model.bind('change', this.render, this);
this.bind('spinner',this.showSpinner, this);
},
…
presents and erroneous and quite misleading code fragment. Instead, I would suggest that the initialize function should not be omitted for clarity purposes:
...
var appleView = Backbone.View.extend({ initialize: function(){
this.model = new (Backbone.Model.extend({}));
this.model.bind('change', this.render, this);
this.bind('spinner',this.showSpinner, this);
},
...
Of course, one can see the final code a couple of lines below, but for the sake of code readability it’s better that this line is included.
Thank you for a great resource!
The text was updated successfully, but these errors were encountered:
In the Event Binding section http://rapidprototypingwithjs.com/#event-binding, the 3rd code sample:
...
var appleView = Backbone.View.extend({
this.model = new (Backbone.Model.extend({}));
this.model.bind('change', this.render, this);
this.bind('spinner',this.showSpinner, this);
},
…
presents and erroneous and quite misleading code fragment. Instead, I would suggest that the initialize function should not be omitted for clarity purposes:
...
var appleView = Backbone.View.extend({
initialize: function(){
this.model = new (Backbone.Model.extend({}));
this.model.bind('change', this.render, this);
this.bind('spinner',this.showSpinner, this);
},
...
Of course, one can see the final code a couple of lines below, but for the sake of code readability it’s better that this line is included.
Thank you for a great resource!
The text was updated successfully, but these errors were encountered: