We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

PowerManager Redirect 1

« DOM Reference

This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

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

The PowerManager interface allows to explicitly control the part of the device that uses power.

Interface overview

callback wakeLockListener = void (DOMString topic, DOMString state);

interface PowerManager
  attribute boolean cpuSleepAllowed
  attribute double screenBrightness
  attribute boolean screenEnabled

  void addWakeLockListener(wakeLockListener listener);
  void factoryReset();
  DOMString getWakeLockState(DOMString topic);
  void powerOff();
  void reboot();
  void removeWakeLockListener(wakeLockListener listener);  


This property allows to know if the device's screen is currently enabled (true). This property also controls the device's screen, so setting it to false will turn off the screen.
This property defines how bright the screen's backlight is, on a scale from 0 (very dim) to 1 (full brightness). Setting this attribute modifies the screen's brightness.
This property determines if the device's CPU will sleep after the screen is disabled. Setting this attribute to false will prevent the device from entering a suspend state.


Register a handler to be called each time a resource changes its lock state.
Reset the device to its factory state (all the user data will be lost).
Return the current lock state of a given topic on the device.
Shut off the device.
Completely shut down and boot the device.
Remove a handler previously set with addWakeLockListener.


var screenTimeout;
var power = window.navigator.mozPower;
var powerAction = {
  unlocked: function suspendDevice() {
    power.cpuSleepAllowed = true;
    power.screenEnabled   = false;

  'locked-background': function shutOffOnlyScreen() {
    power.cpuSleepAllowed = false;
    power.screenEnabled   = false;

function screenLockListener(topic, state) {
  if ('screen' !== topic) return;


  if (powerAction[state]) {
    screenTimeout = window.setTimeout(powerAction[state], 3000);



Not part of any specification

See also

Document Tags and Contributors

 Last updated by: Sheppy,