I'm trying to do some FirefoxOS apps, but I have not seen any easy way to store local data. I hear about IndexedDB, but it seems too complex. Is there any other alternative? If not, is there any easy tutorial about it?
I have considered to store and recove remote data (doing a croos domain request), but I'm having some issues with the permissions. Is there any tutorial about XHR for FirefoxOS?
Thanks.
The best IndexDB doc I can found is Using IndexDB in MDN.
And there are plenty of default Firefox OS apps (gaia) such as gallery, browser using IndexDB. You can see how it works in real life.
Or you can use the more lightweight window.localStorage API, which works like a dictionary.
localStorage.setItem(key, value);
localStorage.getItem(key);
EDIT: Note that localStorage is not recommend because its block the main thread. You should use gaia/shared/asyncStorage
instead.
For XHR you can check Firefox-OS-Boilerplate-App for a working XHR demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With