[Pkg-javascript-commits] [backbone] 30/101: fleshing out destroy

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:26 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.1.0
in repository backbone.

commit 2ca43eaa5f9a8b9c7fb0fa51053c3c49c8be254d
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Tue Oct 5 15:51:23 2010 -0400

    fleshing out destroy
---
 backbone.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/backbone.js b/backbone.js
index 8db4e17..990eca3 100644
--- a/backbone.js
+++ b/backbone.js
@@ -254,7 +254,13 @@
 
     // Destroy this model on the server.
     destroy : function(options) {
-      Backbone.request('DELETE', this, options.success, options.error);
+      options || (options = {});
+      var model = this;
+      var success = function(resp) {
+        if (model.collection) model.collection.remove(model);
+        if (options.success) options.success(model, resp);
+      };
+      Backbone.request('DELETE', this, success, options.error);
       return this;
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list