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

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support No support No support No support No support No support
Feature Android Chrome Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support No support No support No support 1.0.1 No support No support No support
Available in web workers No support No support No support 2.0 No support No support No support

See also

Document Tags and Contributors

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