Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to choose storage type #276

Open
amellini opened this issue Apr 20, 2018 · 5 comments
Open

Ability to choose storage type #276

amellini opened this issue Apr 20, 2018 · 5 comments

Comments

@amellini
Copy link

I'd like to choose the default storage engine (sessionStorage, i need to store different information for different tabs), i don't use NPM.
It will be a good solution to allow the user to select a "default" storage and if not available to fall to other engine.

There's a simple way to do this or i need to create my own store pack (with the list of all engines)?

@yonib05
Copy link

yonib05 commented Mar 12, 2019

+1

@galtenberg
Copy link

Now I get why the docs don't explain how to do this. Would love to! I currently import via unpkg.

🙏

@dgbeck
Copy link

dgbeck commented May 21, 2020

yes, sometimes you want localStorage and sometimes you want sessionStorage, for different use cases. but you want to use the same nice API for both...

@TafkaMax
Copy link

If i am using NPM how do I choose storage type, I also want to use sessionStorage.

@roy-rayyone
Copy link

try this

import store from 'store';
// @ts-ignore
import cookieStorage from 'store/storages/cookieStorage';

const cs = store.createStore([cookieStorage]);
cs.set(key, value);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants