-
Notifications
You must be signed in to change notification settings - Fork 15
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
Localstorage working #1
Conversation
@@ -19,19 +19,27 @@ class LocalStorage extends Service { | |||
} | |||
|
|||
create(... args) { | |||
return super.create(... args).then(this.flush); | |||
return super.create(... args).then(data => { | |||
return this.flush.call(this, data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorthand: return super.create(... args).then(data => this.flush(data));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure I tried that and it didn't work. I'll double check.
ready() { | ||
if(!this.store) { | ||
return Promise.resolve(this.storage.getItem(this.storageKey)) | ||
.then(str =>JSON.parse(str || '{}')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might have to have a try catch here in case someone pre-loads their localstorage data with invalid JSON.
a5b7246
to
605e911
Compare
feathersjs-ecosystem/errors#26 will need to be landed and |
Good thing is that |
Still need to get a new version of |
This gets all the tests passing (server side) and adds examples, etc. In theory because the node module api is the same as the browser it should work just fine there too.