We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

B2G OS

Navigator.getDataStores()

This API is available on Firefox OS for internal applications only.

Summary

The navigator.getDataStores() method provides access to a list of the Data Store API data stores available on the device.

Syntax

navigator.getDataStores('contacts').then(function(stores) {
  // do something with the array of data stores in stores
});

Parameters

storeName
The name of the data store you want to return. An array is returned because there may be multiple data stores with the same name.

Returns

A Promise object that will resolve with an array of DataStore objects.

Example

navigator.getDataStores('contacts').then(function(stores) {
  stores[0].getLength().then(function(storeLength) {
    if(storeLength == 0) {
      for(i = 0; i < contactsInit.length; i++) {
        addContact(stores[0],contactsInit[i]);  
      };
    } else {
      var cursor = stores[0].sync();
      runNextTask(cursor);
    }
  });
});

Specifications

Specification Status Comment
Data Store API Draft The discussion concerning this API's creation happened in various Mozilla mailing lists and other places. A summary of the discussion and further pointers can be found on the Mozilla Wiki. For further feedback and questions, send mail to the dev-webapi mailing list.

Browser compatibility

Supported in Firefox OS 1.0.1.
Available in web workers in Firefox OS 2.0.

See also

Document Tags and Contributors

Contributors to this page: fscholz, chrisdavidmills, teoli
Last updated by: fscholz,