Skip to content

Ultra lightweight & seamless Backbone.sync override to work with promises.

Notifications You must be signed in to change notification settings

spacenick/backbone-sync-deferred

Repository files navigation

Backbone-sync-deferred

Build Status (tests are really messy right now)

Ultra lightweight & seamless Backbone.sync override to work with promises.

Just include the script after backbone. And you'll be able to do :

var myModel = new Backbone.Model();
myModel.url = "https://my.balling-api.com/whatever";

myModel.fetch().then(function(data){
  console.log(data);
  // data is RAW json
  // however, classic "callback" is still called seamlessly so:
  // data.attribute == myModel.get('attribute')
},
function(response){
  console.log(response.statusText);
});

And basically use them on every methods that is using Backbone.sync (collection fetch, model save, etc....)

About

Ultra lightweight & seamless Backbone.sync override to work with promises.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published