Search code examples
firefox-os

Store data in FirefoxOS


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.


Solution

  • I recommend you using asyncStorage over localStorage, is an asynchronous version of localStorage, with the same api and the benefits of IndexedDB.

    You can see the code and learn how to use it reading the comments of the file:

    https://github.com/mozilla-b2g/gaia/blob/master/shared/js/async_storage.js