readd some used code

This commit is contained in:
Olivier Gagnon
2021-09-20 13:53:04 -04:00
parent e9b030c450
commit 9552ae3ef1
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -20,6 +20,7 @@ function load(cb: () => void): void {
* Object store is called savestring
* key for the Object store is called save
*/
// Version 1 is important
const indexedDbRequest: IDBOpenDBRequest = window.indexedDB.open("bitburnerSave", 1);
indexedDbRequest.onerror = function (this: IDBRequest<IDBDatabase>, ev: Event) {
@@ -45,6 +46,12 @@ function load(cb: () => void): void {
cb();
};
};
// This is called when there's no db to begin with. It's important.
indexedDbRequest.onupgradeneeded = function (this: IDBRequest<IDBDatabase>) {
const db = this.result;
db.createObjectStore("savestring");
};
}
export function LoadingScreen(): React.ReactElement {