From 9a7623de1458f799baa109d0afbed08547874550 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 15 Dec 2021 13:33:02 +0100 Subject: facilitate mocking imported values --- common/indexeddb.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'common') 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; -- cgit v1.2.3