Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backbone-callbacks

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-callbacks - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

History.md

4

backbone-callbacks-min.js

@@ -1,2 +0,2 @@

/* backbone-callbacks - v0.1.0 - 2012-06-05 */
(function(a){var b=a._||require("underscore")._,c=a.Backbone||require("backbone"),d=function(a,c){return function(){var d=b.toArray(arguments),e=d[d.length-1];if(typeof e=="function"){d.splice(-1,1),(d.length===0||d.length===1&&a==="save")&&d.push({});var f=d[d.length-1];f.success=function(a,b){e(null,b)},f.error=function(a,b){e(b,null)}}return c.apply(this,d)}};module&&typeof module.exports!="undefined"?module.exports=d:a.BackboneCallbacks=d,d.attach=function(a){b.each(["save","destroy","fetch"],function(b){a.Model.prototype[b]=new d(b,a.Model.prototype[b])}),b.each(["fetch"],function(b){a.Collection.prototype[b]=new d(b,a.Collection.prototype[b])})}})(this);
/* backbone-callbacks - v0.1.2 - 2012-06-13 */
(function(a){var b=a._||require("underscore")._,c=a.Backbone||require("backbone"),d=function(a,c){return function(){var d=b.toArray(arguments),e=d[d.length-1];if(typeof e=="function"){d.splice(-1,1),d.length===0&&d.push({}),d.length===1&&a==="save"&&d.push({});var f=d[d.length-1];f.success=function(a,b){e(null,b)},f.error=function(a,b){e(b,null)}}return c.apply(this,d)}};typeof module!="undefined"&&typeof module.exports!="undefined"?module.exports=d:a.BackboneCallbacks=d,d.attach=function(a){b.each(["save","destroy","fetch"],function(b){a.Model.prototype[b]=new d(b,a.Model.prototype[b])}),b.each(["fetch"],function(b){a.Collection.prototype[b]=new d(b,a.Collection.prototype[b])})}})(this);

@@ -68,4 +68,3 @@ // BackboneCallbacks.js (c) 2012 Loren West and other contributors

// Provide the response as the error.
// Also provide it in 2nd arg for callback consistency.
callback(response, response);
callback(response, null);
};

@@ -80,3 +79,3 @@ }

// Expose as the module for CommonJS, and globally for the browser.
if (module && typeof module.exports !== 'undefined') {
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = BackboneCallbacks;

@@ -83,0 +82,0 @@ } else {

{
"name": "backbone-callbacks",
"version": "0.1.1",
"version": "0.1.2",
"main": "./backbone-callbacks.js",

@@ -5,0 +5,0 @@ "description": "Anonymous callback style interface for Backbone.js async methods",

@@ -13,3 +13,4 @@ ## Anonymous callback interface for Backbone.js async methods

This library adds a simpler node.js style callback interface for these methods:
If you're using Node.js and use your Backbone models on the client as well as the server,
you may want to interact with your models in more of a Node.js async callback style:

@@ -20,2 +21,6 @@ myModel.fetch(function(error, response) {

This library adds to the existing interface for ```fetch```, ```save```, and ```destroy```, allowing you to choose the style you prefer.
If a callback function is provided as the last argument, it uses that style. Otherwise it will use the default ```success/error``` style.
To use this libary:

@@ -34,2 +39,1 @@

This small library (under 1k) adds to the existing interface, allowing either style to be used. If a callback function is provided as the last argument, it will use the simpler style. Otherwise it will use the original ```success/error``` style.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc