small refactor
This commit is contained in:
parent
4b56e06472
commit
810ce0bf5d
1 changed files with 12 additions and 16 deletions
|
|
@ -223,23 +223,19 @@ Storage.prototype.getWallets = function(cb) {
|
||||||
if (!l)
|
if (!l)
|
||||||
return cb([]);
|
return cb([]);
|
||||||
|
|
||||||
for (var ii in ids) {
|
_.each(ids, function(id) {
|
||||||
// Create a closure for async calls.
|
self.getName(id, function(name) {
|
||||||
(function() {
|
wallets.push({
|
||||||
var id = ids[ii];
|
id: id,
|
||||||
self.getName(id, function(name) {
|
name: name,
|
||||||
wallets.push({
|
|
||||||
id: id,
|
|
||||||
name: name,
|
|
||||||
});
|
|
||||||
if (++i == l) {
|
|
||||||
self.wListCache.data = wallets;
|
|
||||||
self.wListCache.ts = Date.now() + CACHE_DURATION;
|
|
||||||
return cb(wallets);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
})();
|
if (++i == l) {
|
||||||
}
|
self.wListCache.data = wallets;
|
||||||
|
self.wListCache.ts = Date.now() + CACHE_DURATION;
|
||||||
|
return cb(wallets);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue