mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
One simplification step further...
This commit is contained in:
10
backbone.js
10
backbone.js
@@ -427,7 +427,7 @@
|
||||
if (success) success(model, resp, options);
|
||||
model.trigger('sync', model, resp, options);
|
||||
};
|
||||
options.error = wrapError(this, options);
|
||||
wrapError(this, options);
|
||||
return this.sync('read', this, options);
|
||||
},
|
||||
|
||||
@@ -474,7 +474,7 @@
|
||||
if (success) success(model, resp, options);
|
||||
model.trigger('sync', model, resp, options);
|
||||
};
|
||||
options.error = wrapError(this, options);
|
||||
wrapError(this, options);
|
||||
|
||||
method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
|
||||
if (method === 'patch') options.attrs = attrs;
|
||||
@@ -508,7 +508,7 @@
|
||||
options.success();
|
||||
return false;
|
||||
}
|
||||
options.error = wrapError(this, options);
|
||||
wrapError(this, options);
|
||||
|
||||
var xhr = this.sync('delete', this, options);
|
||||
if (!options.wait) destroy();
|
||||
@@ -830,7 +830,7 @@
|
||||
if (success) success(collection, resp, options);
|
||||
collection.trigger('sync', collection, resp, options);
|
||||
};
|
||||
options.error = wrapError(this, options);
|
||||
wrapError(this, options);
|
||||
return this.sync('read', this, options);
|
||||
},
|
||||
|
||||
@@ -1503,7 +1503,7 @@
|
||||
// Wrap an optional error callback with a fallback error event.
|
||||
var wrapError = function (model, options) {
|
||||
var error = options.error;
|
||||
return function(resp) {
|
||||
options.error = function(resp) {
|
||||
if (error) error(model, resp, options);
|
||||
model.trigger('error', model, resp, options);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user