From d2a99b5be1de815f1e4fab3fdbd1f7842ad3bcb8 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 23 Feb 2022 09:12:41 +0300 Subject: [PATCH] simplify getProxy --- background/db.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/background/db.js b/background/db.js index f674723a..0d89ead6 100644 --- a/background/db.js +++ b/background/db.js @@ -30,11 +30,9 @@ const db = (() => { }; /** * @param {string} dbName - * @param {boolean} [idAsKey] - if true, only objects can be stored with a unique `id` property * @return {IDBObjectStore | {putMany: function(items:?[]):Promise}} */ - const getProxy = (dbName, idAsKey) => proxies[dbName] || ( - (ID_AS_KEY[dbName] = idAsKey), + const getProxy = dbName => proxies[dbName] || ( (proxies[dbName] = new Proxy({dbName}, proxyHandler)) ); addAPI(/** @namespace API */ { @@ -44,7 +42,7 @@ const db = (() => { prefsDb: getProxy(prefs.STORAGE_KEY), }); return { - styles: getProxy(DB, true), + styles: getProxy(DB), }; async function cachedExec(dbName, cmd, a, b) {