summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-12-15 13:33:02 +0100
committerWojtek Kosior <koszko@koszko.org>2021-12-15 13:33:02 +0100
commit9a7623de1458f799baa109d0afbed08547874550 (patch)
tree5e62c0c22e680666a3d7729b5b8f01051cade2f7 /common
parent58fe4c7d806359bed299f74ba56902ab396a6ed1 (diff)
downloadbrowser-extension-9a7623de1458f799baa109d0afbed08547874550.tar.gz
browser-extension-9a7623de1458f799baa109d0afbed08547874550.zip
facilitate mocking imported values
Diffstat (limited to 'common')
-rw-r--r--common/indexeddb.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/common/indexeddb.js b/common/indexeddb.js
index c6302fa..96d19b7 100644
--- a/common/indexeddb.js
+++ b/common/indexeddb.js
@@ -92,7 +92,7 @@ async function idb_del(transaction, store_name, key)
}
/* Open haketilo database, asynchronously return an IDBDatabase object. */
-async function get_db(data=initial_data)
+async function get_db()
{
if (db)
return db;
@@ -120,9 +120,8 @@ async function get_db(data=initial_data)
for (const [store_name, key_mode] of stores)
store = opened_db.createObjectStore(store_name, key_mode);
- const context = make_context(store.transaction, data.files);
-
- await _save_items(data.resources, data.mappings, context);
+ const ctx = make_context(store.transaction, initial_data.files);
+ await _save_items(initial_data.resources, initial_data.mappings, ctx);
}
db = opened_db;