Closed giacomorebonato closed 8 years ago
Oh well to be honest I haven't heard about it until now. I guess one huge reason it's not used is browser support http://caniuse.com/#feat=indexeddb.
Also localstorage is only in the repo and in the examples because I needed it for myself, not because I recommend it over anything else. It's really trivial to implement if you look at the source: https://github.com/AriaFallah/mobx-store/blob/master/src/localstorage.js
// @flow
function read(source: string) {
const data = localStorage.getItem(source)
if (data) {
return JSON.parse(data)
}
return {}
}
function write(dest: string, store: Object) {
return localStorage.setItem(dest, JSON.stringify(store.toJs()))
}
export default { read, write }
I hope that answers your questions.
Yes, thank you!
It seems to me that localStorage is always mentioned for data persistence in a browser.
What is the reason why nobody talks about IndexedDB?
Do the benchmark discourage the use? I love this project and MobX and I hope I can contribute.