let DBOpenRequest = window.indexedDB.open("vchess_comp", 4);
DBOpenRequest.onerror = function(event) {
- alert(store.state.tr["Database error: stop private browsing, or update your browser"]);
+ alert(store.state.tr[
+ "Database error: stop private browsing, or update your browser"]);
callback("error", null);
};
DBOpenRequest.onupgradeneeded = function(event) {
let db = event.target.result;
- db.createObjectStore("compgames", { keyPath: "vname" });
+ let upgradeTransaction = event.target.transaction;
+ if (!db.objectStoreNames.contains("compgames"))
+ db.createObjectStore("compgames", { keyPath: "vname" });
+ else
+ upgradeTransaction.objectStore("compgames");
};
}