Open davidrapin opened 7 years ago
A good place to start might be looking at https://github.com/localForage/localForage and get a sense of how we'd want to do jt
@marcuswestin it seems as though it is some minor setup, environment checks to make it happen. The calls that it makes would need to be asynchronous though. I know that you are pretty focused on keeping a synchronous project, but a simple promise shim would keep functionality for < ie8
We definitely need to add an async API.
I like the idea of having a sync, localStorage backed store for more trivial key-value storage and an async indexDB backed store for larger blobs working in parallel.
I'm considering a few options:
store.get.async('foo').then(...)
and store.set.async('foo', 'bar').then(...)
store.async.read('foo').then(...)
or store.blobs.read/write
etcI'd love input on this!
@marcuswestin, I think you have the right idea for a starting point. Although, I think that the async
object in the library should expose 2 items: get
set
as opposed to the other way around. store.async.get('foo').then(...)
and store.async.set('foo', 'bar').then(...)
looks cleaner to me. In terms of reading/writing blobs/files why not just have this functionality put into get/set?
There is a wrapper called Dexie. anyone comment on how is that ?
IndexedDB exists in many modern browsers. I don't know about performances vs. localStorage. Support for IndexedDB would be great :)