MozPowerManager.screenEnabled

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

The MozPowerManager.screenEnabled property allows to know if the device's screen is currently enabled (true).

It also controls the device's screen, so setting it to false will turn off the screen.

Syntax

JavaScript
var isTheScreenEnabled = navigator.mozPower.screenEnabled

Value

Return a boolean.

Example

JavaScript
// If the screen is active
if (navigator.mozPower.screenEnabled) {
  // Let's shut it off
  navigator.mozPower.screenEnabled = false;
}

Specification

Not part of any specification.

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/powermanager/screenenabled

API B2G Firefox OS Power Management Property Reference Référence