• Skip to main content
  • Select language
  • Skip to search
MDN Web Docs
  • Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs / DOM
    • WebExtensions
    • MathML
  • References & Guides
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
B2G OS
  1. MDN
  2. Archive of obsolete content
  3. B2G OS
  4. B2G OS APIs
  5. SettingsLock
  6. SettingsLock.get()

SettingsLock.get()

In This Article
  1. Summary
  2. Syntax
    1. Parameters
  3. Example
  4. Specification
  5. See also

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

  • SettingsManager
  • SettingsLock
  • Settings API

Document Tags and Contributors

Tags: 
  • API
  • B2G
  • Firefox OS
  • Method
  • Non-standard
  • Reference
  • Référence
  • Settings
 Contributors to this page: chrisdavidmills, teoli, MHasan, mcav, kscarfone, Sheppy, janjongboom, Jeremie
 Last updated by: chrisdavidmills, Feb 27, 2017, 2:07:34 AM
See also
  1. Settings API
  2. Archive
  3. Events
    1. settingchange
  4. Related pages for Settings API
    1. MozSettingsEvent
    2. SettingsLock
    3. SettingsManager