mozilla

PowerManager.getWakeLockState()

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

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

Syntax

PowerManager.getWakeLockState(resourceName);

Parameters

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

Return

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);

Specification

Not part of any specification.

See also

Document Tags and Contributors

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