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

Prevent key conflict and keep iterable behavior #104

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

iagodahlem
Copy link

This fixes #102.

Based on #66 I changed the current implementation of the LocalStorage class to be a factory function that uses a Proxy internally.

This way we avoid key conflicts and keeps the iterable behavior.

So given the storage object, we can call Object.entries/keys/values or even just call the storage object itself that it will resolve to an object with all and just the stored items in it, as the native implementation does.

@clarkbw
Copy link
Owner

clarkbw commented May 8, 2019

This looks great at first pass! Lemme figure out what's going on with Circle and get back to this

@iagodahlem
Copy link
Author

Cool, thanks!

Do you think we should remove localStorage.__STORE__[<key>] references from the README and encourage people to use localStorage[<key>]?

@clarkbw
Copy link
Owner

clarkbw commented May 8, 2019 via email

@iagodahlem
Copy link
Author

@clarkbw any updates?

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

Successfully merging this pull request may close these issues.

localStorage key "key" is reserved?
2 participants