marcuswestin / store.js

Cross-browser storage for all use cases, used across the web.
MIT License
14.02k stars 1.33k forks source link

how do i read specifically items from session storage #286

Open geetee24 opened 6 years ago

geetee24 commented 6 years ago

it appears that there is no way to specify which store I want? the lib always grabs from ls. I need from SS

joel-chu commented 5 years ago

You build your store

Example in ES6

// session store with watch
import engine from 'store/src/store-engine';

import sessionStorage from 'store/storages/sessionStorage';
import cookieStorage from 'store/storages/cookieStorage';

import defaultPlugin from 'store/plugins/defaults';
import expiredPlugin from 'store/plugins/expire';
import eventsPlugin from 'store/plugins/events';

const storages = [sessionStorage, cookieStorage];
const plugins = [defaultPlugin, expiredPlugin, eventsPlugin];

const sessionStore = engine.createStore(storages, plugins);

export default sessionStore;