let DBOpenRequest = window.indexedDB.open("vchess_comp", 4);
DBOpenRequest.onerror = function(event) {
let DBOpenRequest = window.indexedDB.open("vchess_comp", 4);
DBOpenRequest.onerror = function(event) {
let objectStore = db
.transaction("compgames", "readwrite")
.objectStore("compgames");
objectStore.get(gameId).onsuccess = function(event) {
// Ignoring error silently: shouldn't happen now. TODO?
let objectStore = db
.transaction("compgames", "readwrite")
.objectStore("compgames");
objectStore.get(gameId).onsuccess = function(event) {
// Ignoring error silently: shouldn't happen now. TODO?
const game = event.target.result;
Object.keys(obj).forEach(k => {
if (k == "move") game.moves.push(obj[k]);
const game = event.target.result;
Object.keys(obj).forEach(k => {
if (k == "move") game.moves.push(obj[k]);
// Retrieve any game from its identifier (variant name)
// NOTE: need callback because result is obtained asynchronously
get: function(gameId, callback) {
// Retrieve any game from its identifier (variant name)
// NOTE: need callback because result is obtained asynchronously
get: function(gameId, callback) {
let objectStore = db
.transaction("compgames", "readonly")
.objectStore("compgames");
let objectStore = db
.transaction("compgames", "readonly")
.objectStore("compgames");
if (!err) {
db.transaction("compgames", "readwrite")
.objectStore("compgames")
if (!err) {
db.transaction("compgames", "readwrite")
.objectStore("compgames")