Skip to content

Commit

Permalink
using _.bindAll since 0.5.2 is IMHO deprecated.
Browse files Browse the repository at this point in the history
Documentation suggest adding context as a third parameter to bind. I also noticed that _.bindAll is less clear to newcomers.
  • Loading branch information
OpenGrid committed Jan 17, 2012
1 parent 5c1c758 commit a40ccfc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1646,9 +1646,8 @@ var TodoView = Backbone.View.extend({
// The TodoView listens for changes to its model, re-rendering. Since there's // The TodoView listens for changes to its model, re-rendering. Since there's
// a one-to-one correspondence between a **Todo** and a **TodoView** in this // a one-to-one correspondence between a **Todo** and a **TodoView** in this
// app, we set a direct reference on the model for convenience. // app, we set a direct reference on the model for convenience.
initialize: function() { initialize: function() {
_.bindAll(this, 'render', 'close'); this.model.bind('change', this.render, this);
this.model.bind('change', this.render);
this.model.view = this; this.model.view = this;
}, },
... ...
Expand Down Expand Up @@ -1703,9 +1702,8 @@ define([
// The TodoView listens for changes to its model, re-rendering. Since there's // The TodoView listens for changes to its model, re-rendering. Since there's
// a one-to-one correspondence between a **Todo** and a **TodoView** in this // a one-to-one correspondence between a **Todo** and a **TodoView** in this
// app, we set a direct reference on the model for convenience. // app, we set a direct reference on the model for convenience.
initialize: function() { initialize: function() {
_.bindAll(this, 'render', 'close'); this.model.bind('change', this.render, this);
this.model.bind('change', this.render);
this.model.view = this; this.model.view = this;
}, },


Expand Down

0 comments on commit a40ccfc

Please sign in to comment.