News for hackers. Stuff that matters.
Re:Step by step from jQuery to Backbone by politician on Monday January 28, 2013 @11:09PM (#5132273)
We fixed this by modifying the Collection#create function to return the result of calling model.save (line 840) which is a jQuery Promise. We may or may not have .pipe'd it, I'd have to check.

Next, we leveraged the Promise API to handle success and error callbacks, specifically:

    collection.create(bleh)
      .done(function (model) { var xhr = this; })
      .fail(function (resp) { var xhr = this; });
This is far cleaner that screwing around with success/error callbacks which don't work well when you're trying to mock the backend. If you want to get fancy (we did), you can build a default fail function and always pass that.

There are no comments on this comment yet.