mirror of https://github.com/BTCPrivate/copay.git
small refactor
This commit is contained in:
parent
4b56e06472
commit
810ce0bf5d
|
@ -223,23 +223,19 @@ Storage.prototype.getWallets = function(cb) {
|
|||
if (!l)
|
||||
return cb([]);
|
||||
|
||||
for (var ii in ids) {
|
||||
// Create a closure for async calls.
|
||||
(function() {
|
||||
var id = ids[ii];
|
||||
self.getName(id, function(name) {
|
||||
wallets.push({
|
||||
id: id,
|
||||
name: name,
|
||||
});
|
||||
if (++i == l) {
|
||||
self.wListCache.data = wallets;
|
||||
self.wListCache.ts = Date.now() + CACHE_DURATION;
|
||||
return cb(wallets);
|
||||
}
|
||||
_.each(ids, function(id) {
|
||||
self.getName(id, function(name) {
|
||||
wallets.push({
|
||||
id: id,
|
||||
name: name,
|
||||
});
|
||||
})();
|
||||
}
|
||||
if (++i == l) {
|
||||
self.wListCache.data = wallets;
|
||||
self.wListCache.ts = Date.now() + CACHE_DURATION;
|
||||
return cb(wallets);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue