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

clearAll() per namespace? #300

Open
bblimke opened this issue Jun 7, 2019 · 4 comments · May be fixed by #329
Open

clearAll() per namespace? #300

bblimke opened this issue Jun 7, 2019 · 4 comments · May be fixed by #329

Comments

@bblimke
Copy link

bblimke commented Jun 7, 2019

Is there a way to clear store for only one namespace?

When I create multiple stores with different namespaces and I call clearAll on any of them,
it clears the data from all the stores.

var ns1 = store.namespace('ns1')
var ns2 = store.namespace('ns2')
ns1.set('foo', 'bar1')
ns2.set('foo', 'bar2')
ns1.get('foo') == 'bar1'
ns2.get('foo') == 'bar2'

ns1.clearAll()
ns1.get('foo')  //undefined
ns2.get('foo')  //undefined
@nbubna
Copy link

nbubna commented Jun 7, 2019

Why not just use clear()

@bblimke
Copy link
Author

bblimke commented Jun 7, 2019

@nbubna Thank you! I didn't know about clear 👍

@bblimke
Copy link
Author

bblimke commented Jun 7, 2019

@nbubna I get ns1.clear is not a function. Am I using outdated version?

@nbubna
Copy link

nbubna commented Jun 7, 2019

Oops. Sorry, i didn't have my caffeine this morning. I thought this was a bug on my store2 library, not Marcus' lib. Eeek. Major fail. Sorry.

arhemd added a commit to arhemd/store.js that referenced this issue Dec 24, 2021
@arhemd arhemd linked a pull request Dec 24, 2021 that will close this issue
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 a pull request may close this issue.

2 participants