backbone-identity-map
Advanced tools
Comparing version 0.1.1 to 0.1.2
16
index.js
@@ -64,3 +64,19 @@ (function (root, factory) { | ||
Backbone.IdentityMap.prototype.findMany = function (collectionKeys, next) { | ||
var i = 0, len = collectionKeys.length, fetchedCollections = []; | ||
this.find(collectionKeys[i], loop.bind(this)); | ||
function loop (coll) { | ||
fetchedCollections.push(coll) | ||
if (++i >= len ) { | ||
next(fetchedCollections); | ||
} | ||
this.find(collectionKeys[i], loop.bind(this)); | ||
} | ||
}; | ||
Backbone.IdentityMap.prototype.find = function (collectionKey, next) { | ||
var _this = this; | ||
this.cache.find(collectionKey, function (res) { | ||
@@ -67,0 +83,0 @@ var collection = _this._getCollectionConstr(collectionKey); |
{ | ||
"name": "backbone-identity-map", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Identity map implementation for BackboneJS. Uses IndexDB to cache objects", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
8551
188