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

Retrieving value which are not set by Lockr #57

Open
gokatz opened this issue Aug 22, 2018 · 2 comments
Open

Retrieving value which are not set by Lockr #57

gokatz opened this issue Aug 22, 2018 · 2 comments

Comments

@gokatz
Copy link

gokatz commented Aug 22, 2018

Thanks for this super tiny package that elegantly handles the localStorage 🙂

I can see that Lockr is not designed to retrieve data that are not set by itself. Can we make it to retreive the data that are not set by Lockr with the help of options argument ?

like,

window.localStorage.setItem('nameObj', JSON.stringify({first: 'Gokul', last: 'Kathirvel'}));

Lockr.get('nameObj');
// undefined

Lockr.get('nameObj', null, { processRaw: true });
// {first: 'Gokul', last: 'Kathirvel'}

or if the fetched value from storage is not abiding the structure (.data), then we can return the actual fetched value itself like this

@tsironis
Copy link
Owner

Hello gokatz,
Sorry for the late reply. I would like to see some specs on this behavior in order to define it more accurately.
I prefer not to overcomplicate things if it's not absolutely necessary.

@gokatz
Copy link
Author

gokatz commented Sep 28, 2018

Agreed. This will be really helpful if the application set localStorage things without Lockr (Maybe manually keying in values directly into Application tab of browser) but fetching via Locker in Application code (for consistency). I understand this use case is weird 😁

But I'm doing this in my app (a developer tool kinda thing) 😄

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

2 participants