Don't cache roster so separate pq games don't stomp on each other

This commit is contained in:
Eric Fredricksen
2021-12-09 11:18:12 -08:00
committed by Eric Fredricksen
parent 048ada9faf
commit 01f208d1a5
+6 -10
View File
@@ -256,8 +256,9 @@ storage.loadRoster = function (callback) {
// aight // aight
} }
} }
storage.games = value || {}; value = value || {};
callback(storage.games); callback(value);
storage.games = value;
} }
this.getItem("roster", gotItem); this.getItem("roster", gotItem);
} }
@@ -288,15 +289,10 @@ storage.storeRoster = function (roster, callback) {
} }
storage.addToRoster = function (newguy, callback) { storage.addToRoster = function (newguy, callback) {
if (this.games) { this.loadRoster(function (games) {
this.games[newguy.Traits.Name] = newguy; games[newguy.Traits.Name] = newguy;
this.storeRoster(this.games, callback); storage.storeRoster(games, callback);
} else {
this.loadRoster(function () {
if (storage.games) // should always be true
storage.addToRoster(newguy, callback);
}); });
}
} }
Number.prototype.div = function (divisor) { Number.prototype.div = function (divisor) {