backbone-callbacks
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -52,5 +52,10 @@ // BackboneCallbacks.js (c) 2012 Loren West and other contributors | ||
// Place options if none were specified. | ||
if (args.length === 0 || (args.length === 1 && methodName === 'save')) { | ||
if (args.length === 0) { | ||
args.push({}); | ||
} | ||
// Place attributes if save and only options were specified | ||
if (args.length === 1 && methodName === 'save') { | ||
args.push({}); | ||
} | ||
var options = args[args.length - 1]; | ||
@@ -63,3 +68,5 @@ | ||
options.error = function(model, response) { | ||
callback(response, null); | ||
// Provide the response as the error. | ||
// Also provide it in 2nd arg for callback consistency. | ||
callback(response, response); | ||
}; | ||
@@ -66,0 +73,0 @@ } |
{ | ||
"name": "backbone-callbacks", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"main": "./backbone-callbacks.js", | ||
@@ -5,0 +5,0 @@ "description": "Anonymous callback style interface for Backbone.js async methods", |
@@ -5,6 +5,6 @@ ## Anonymous callback interface for Backbone.js async methods | ||
myModel.fetch({success: function() { | ||
myModel.fetch({success: function(model, response) { | ||
... | ||
}, | ||
error: function() { | ||
error: function(model, response) { | ||
... | ||
@@ -16,3 +16,3 @@ } | ||
myModel.fetch(function(error) { | ||
myModel.fetch(function(error, response) { | ||
... | ||
@@ -19,0 +19,0 @@ }); |
@@ -14,3 +14,3 @@ // CallbackTest.js (c) 2012 Loren West and other contributors | ||
// method name into the result parameter to verify the call. | ||
// It returns an error if options.errorTest is set. | ||
// For error testing, it returns an error if the method is 'read'. | ||
Backbone.sync = function(method, model, options) { | ||
@@ -17,0 +17,0 @@ if (method === 'read') { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11171
219