Closed redthor closed 12 years ago
Hi Redthor,
You are correct, it is no longer necessary to use _.bindAll
with backbone. Event triggered methods are automatically bound to the scope of the object and the preferred method of binding events is, as you noted, this.collection.on('add', this.addOne, this);
.
We'll leave this issue open until we update the book to this new style.
I think we have all of the bindAll()
statements removed in source. An updated errata should be available shortly.
I would prefer to switch from .bind()
to .on()
after we update for Backbone 0.9 / 1.0.
Fixed in the most recent version of the book.
Hi Guys, Thanks for the book.
is used in a few spots and I understand what it does from the underscore site, but I'm unsure as to why it is required where it is used. I may have missed where you explain why it is necessary. For e.g. (version 2012-01-02 of the book, page 54):
is it necessary to bindAll 'render', 'addAll', and 'addOne'?
Next question: Is using bindAll now deprecated in favor of:
Thanks.