0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-31 17:22:45 +00:00

Remove Proxy version

This commit is contained in:
G.Ambatte
2024-10-30 08:21:51 +13:00
parent 6fed42198d
commit ebf900ba24
2 changed files with 2 additions and 37 deletions

View File

@@ -1,40 +1,5 @@
import * as IDB from 'idb-keyval/dist/index.js';
// The Proxy and the Wrapper _should_ be equivalent
// IndexedDB Proxy
export function initIDBProxy(db, store) {
const PROP_LIST = [
'entries',
'keys',
'values',
'clear',
'get',
'getMany',
'set',
'setMany',
'update',
'del',
'delMany'
];
const IDBHandler = {
get : (target, prop)=>{
if(!PROP_LIST.includes(prop)){ return target[prop]; }
return function (...args) {
return target[prop].apply(target, [...args, target.createStore(db, store)]);
};
}
};
return new Proxy(IDB, IDBHandler);
}
// IndexedDB Wrapper
export function initCustomStore(db, store){
const createCustomStore = async ()=>IDB.createStore(db, store);