mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-12-26 20:28:15 +03:00
29 lines
570 B
JavaScript
29 lines
570 B
JavaScript
|
import {
|
||
|
clear,
|
||
|
createStore,
|
||
|
del,
|
||
|
delMany,
|
||
|
get,
|
||
|
getMany,
|
||
|
keys,
|
||
|
set,
|
||
|
} from 'idb-keyval';
|
||
|
|
||
|
const draftsStore = createStore('drafts-db', 'drafts-store');
|
||
|
|
||
|
// Add additonal `draftsStore` parameter to all methods
|
||
|
|
||
|
const drafts = {
|
||
|
set: (key, val) => set(key, val, draftsStore),
|
||
|
get: (key) => get(key, draftsStore),
|
||
|
getMany: (keys) => getMany(keys, draftsStore),
|
||
|
del: (key) => del(key, draftsStore),
|
||
|
delMany: (keys) => delMany(keys, draftsStore),
|
||
|
clear: () => clear(draftsStore),
|
||
|
keys: () => keys(draftsStore),
|
||
|
};
|
||
|
|
||
|
export default {
|
||
|
drafts,
|
||
|
};
|