aboutsummaryrefslogtreecommitdiff
path: root/ext/js/data/database.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-08-07 15:25:00 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-08-08 16:04:57 -0400
commit4341b5078343dccc3b082a496fd6c158b872fc99 (patch)
tree2e175f3f25c4ef14438fe9a28f7c8fe9a1b6d549 /ext/js/data/database.js
parentb590a147015df21eec02054eb542ff23f2a4c0ef (diff)
Fix data not being persisted after terminating Worker thread (#1877)
Diffstat (limited to 'ext/js/data/database.js')
-rw-r--r--ext/js/data/database.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/js/data/database.js b/ext/js/data/database.js
index a0a1804a..222e376c 100644
--- a/ext/js/data/database.js
+++ b/ext/js/data/database.js
@@ -198,6 +198,16 @@ class Database {
});
}
+ persistData(objectStoreName) {
+ return new Promise((resolve, reject) => {
+ const transaction = this.transaction([objectStoreName], 'readonly');
+ const objectStore = transaction.objectStore(objectStoreName);
+ const cursor = objectStore.openCursor();
+ cursor.onerror = (e) => reject(e.target.error);
+ cursor.onsuccess = () => resolve();
+ });
+ }
+
static deleteDatabase(databaseName) {
return new Promise((resolve, reject) => {
const request = indexedDB.deleteDatabase(databaseName);