• 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. MozPowerManager
  6. MozPowerManager.getWakeLockState()

MozPowerManager.getWakeLockState()

In This Article
  1. Syntax
    1. Parameters
  2. Return value
  3. Example
  4. Specifications
  5. See also

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

The MozPowerManager.getWakeLockState() method is used to retrieve the current lock state of a given resource.

Syntax

MozPowerManager.getWakeLockState(resourceName);

Parameters

resourceName
A string that represent the name of the resource to check.

Return value

This method will return a string that represents the current lock state for the resource. Possible values for this state are:

unlocked
Nobody holds the wake lock.
locked-foreground
At least one window holds the wake lock and is visible.
locked-background
At least one window holds the wake lock, but all of them are hidden.

Example

var state = navigator.mozPower.getWakeLockState('screen')
console.log('screen: ' + state);

Specifications

Not part of any specification.

See also

  • navigator.mozPower
  • PowerManager
  • PowerManager.addWakeLockListener()
  • navigator.requestWakeLock()

Document Tags and Contributors

Tags: 
  • API
  • B2G
  • Firefox OS
  • Method
  • Non Standard
  • Power Management
  • Reference
  • Référence
 Contributors to this page: chrisdavidmills, teoli, MHasan, kscarfone, Sheppy, Jeremie
 Last updated by: chrisdavidmills, Feb 27, 2017, 2:07:41 AM
See also
  1. Power Management API
  2. Archive
  3. Related pages for Power Management API
    1. PowerManager