cosmetics
This commit is contained in:
parent
37c750fbba
commit
71a17b0a98
|
@ -18,24 +18,18 @@ const db = (() => {
|
||||||
)(...args);
|
)(...args);
|
||||||
const DB = 'stylish';
|
const DB = 'stylish';
|
||||||
const FALLBACK = 'dbInChromeStorage';
|
const FALLBACK = 'dbInChromeStorage';
|
||||||
|
const getStoreName = dbName => dbName === DB ? 'styles' : 'data';
|
||||||
const proxies = {};
|
const proxies = {};
|
||||||
const proxyHandler = {
|
const proxyHandler = {
|
||||||
get: ({dbName}, cmd) => (...args) => exec(dbName, cmd, ...args),
|
get: ({dbName}, cmd) => (...args) => exec(dbName, cmd, ...args),
|
||||||
};
|
};
|
||||||
const getProxy = (dbName = DB) =>
|
/** @return {IDBObjectStore | {putMany: function(items:?[]):Promise<?[]>}} */
|
||||||
/** @type {IDBObjectStore | {putMany: function(items:?[]):Promise<?[]>}} */
|
const getProxy = (dbName = DB) => proxies[dbName] || (
|
||||||
proxies[dbName] || (
|
|
||||||
proxies[dbName] = new Proxy({dbName}, proxyHandler)
|
proxies[dbName] = new Proxy({dbName}, proxyHandler)
|
||||||
);
|
);
|
||||||
const getStoreName = dbName =>
|
|
||||||
dbName === DB
|
|
||||||
? 'styles'
|
|
||||||
: 'data';
|
|
||||||
addAPI(/** @namespace API */ {
|
addAPI(/** @namespace API */ {
|
||||||
/**
|
/** Storage for big items that may exceed 8kB limit of chrome.storage.sync.
|
||||||
* Storage for big items that may exceed 8kB limit of chrome.storage.sync.
|
* To make an item syncable register it with uuidIndex.addCustomId. */
|
||||||
* To make an item syncable register it with uuidIndex.addCustomId.
|
|
||||||
*/
|
|
||||||
prefsDb: getProxy(prefs.STORAGE_KEY),
|
prefsDb: getProxy(prefs.STORAGE_KEY),
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user