[Pkg-javascript-commits] [backbone] 06/211: Added append option when fetching a collection. Useful when lazy loading data sets.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:59:56 UTC 2014


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

js pushed a commit to tag 0.5.0
in repository backbone.

commit 3623916f2b251d52394e1afc6f2fd24e49d9d7c6
Author: Chris Korhonen <chris at animoto.com>
Date:   Fri Dec 3 10:39:06 2010 -0500

    Added append option when fetching a collection. Useful when lazy loading data sets.
---
 backbone.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/backbone.js b/backbone.js
index 12f8b84..d124b94 100644
--- a/backbone.js
+++ b/backbone.js
@@ -466,9 +466,13 @@
       options || (options = {});
       var collection = this;
       var success = function(resp) {
-        collection.refresh(collection.parse(resp));
-        if (options.success) options.success(collection, resp);
-      };
+          if(options.append) {
+              collection.add(collection.parse(resp));
+          } else {
+              collection.refresh(collection.parse(resp));
+          }
+          if (options.success) options.success(collection, resp);
+        };
       var error = options.error && _.bind(options.error, null, collection);
       Backbone.sync('read', this, success, 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