-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: add storage interface + implement indexedDb #18
Conversation
Can you add the logic to the |
Can you implement a basic memory store with a plain object? If
that way storage is always available |
src/utils/storage/index.js
Outdated
/** | ||
* @typedef {object} Storage | ||
* @property {function(string):Promise<any>} get - Retrieves the value associated with the key. | ||
* @property {function(string,any):Promise<void>} set - Sets a new value for the key. |
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.
Can it be any value? Is it serialised automatically?
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.
its not serialised automatically. I guess it could be any value but we have to add some extra handling for some storage implementations. For example localStorage only accepts strings as keys and values so what ever gets passed has to be serialisable as a string.
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.
gonna merge then, if we need to add support for non-string storage keys we can do that.
update branch then lgtm |
Changes