How to use the sync function from backbone

Find comprehensive JavaScript backbone.sync code examples handpicked from public code repositorys.

33
34
35
36
37
38
39
40
41
42

save: function (options) {
  this.each(function (layerDefModel, index) {
    layerDefModel.set('order', index, { silent: true });
  });
  Backbone.sync('update', this, options);
},

toJSON: function () {
  return {
fork icon676
star icon0
watch icon2

37
38
39
40
41
42
43
44
45
46
  return endpoint + '?format=json&size=s&jsoncallback=?';
},
sync: function(method, collection, options) {
  options.dataType = "jsonp";
  options.jsonpCallback = "jsonpCallback";
  return Backbone.sync(method, collection, options);
},

parse: function(resp) {
  console.log(resp.items);
fork icon1
star icon0
watch icon2