From 71a17b0a986c633aba220bc5732bc0c864db5727 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 28 Jan 2022 20:42:59 +0300 Subject: [PATCH] cosmetics --- background/db.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/background/db.js b/background/db.js index ca541f01..4c5f112a 100644 --- a/background/db.js +++ b/background/db.js @@ -18,24 +18,18 @@ const db = (() => { )(...args); const DB = 'stylish'; const FALLBACK = 'dbInChromeStorage'; + const getStoreName = dbName => dbName === DB ? 'styles' : 'data'; const proxies = {}; const proxyHandler = { get: ({dbName}, cmd) => (...args) => exec(dbName, cmd, ...args), }; - const getProxy = (dbName = DB) => - /** @type {IDBObjectStore | {putMany: function(items:?[]):Promise}} */ - proxies[dbName] || ( - proxies[dbName] = new Proxy({dbName}, proxyHandler) - ); - const getStoreName = dbName => - dbName === DB - ? 'styles' - : 'data'; + /** @return {IDBObjectStore | {putMany: function(items:?[]):Promise}} */ + const getProxy = (dbName = DB) => proxies[dbName] || ( + proxies[dbName] = new Proxy({dbName}, proxyHandler) + ); addAPI(/** @namespace API */ { - /** - * Storage for big items that may exceed 8kB limit of chrome.storage.sync. - * To make an item syncable register it with uuidIndex.addCustomId. - */ + /** Storage for big items that may exceed 8kB limit of chrome.storage.sync. + * To make an item syncable register it with uuidIndex.addCustomId. */ prefsDb: getProxy(prefs.STORAGE_KEY), }); return {