mozilla

SettingsLock.get()

Non-standard
This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

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

Summary

This method fetches the value of a specified setting.

This method is asynchronous and returns a DOMRequest object, which you use to determine when the request has been completed so that you may act on the results.

Syntax

SettingsLock.get(settingName);

Parameters

settingName
The string name of the setting whose value you wish to retreive. The exact list of possible strings is device dependent. Each Gaia build can have its own list of settings. For an up-to-date list of those strings, take a look at the Gaia source code.

Example

This example checks to see if WiFi is enabled and reports the result.

var lock = navigator.mozSettings.createLock();
var req  = lock.get('wifi.enabled');

req.onsuccess = function () {
  console.log('wifi.enabled: ' + req.result['wifi.enabled']);
}

req.onerror = function () {
  console.log('An error occured: ' + req.error);
}

Specification

Not part of any specification yet; however, this API will be discuss at W3C as part of the System Applications Working Group.

See also

Document Tags and Contributors

Contributors to this page: Sheppy, Jeremie, teoli, janjongboom, kscarfone, mcav, MHasan
Last updated by: teoli,