- objectStore.openCursor().onsuccess = function(event) {
- var cursor = event.target.result;
- // if there is still another cursor to go, keep runing this code
- if (cursor)
- {
- games.push(cursor.value);
- cursor.continue();
+ if (!gameId) //retrieve all
+ {
+ let games = [];
+ objectStore.openCursor().onsuccess = function(event) {
+ let cursor = event.target.result;
+ // if there is still another cursor to go, keep running this code
+ if (cursor)
+ {
+ games.push(cursor.value);
+ cursor.continue();
+ }
+ else
+ callback(games);
+ }
+ }
+ else //just one game
+ {
+ objectStore.get(gameId).onsuccess = function(event) {
+ callback(event.target.result);