MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

MozPowerManager.addWakeLockListener()

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

The MozPowerManager.addWakeLockListener() method is used to register a handler to be called each time a resource changes its lock state.

Syntax

MozPowerManager.addWakeLockListener(handler);

Parameters

handler
It's a callback function that accepts two parameters: a string that contains the name of the resource and a string that figures the lock state for that resource (see getWakeLockState for more information about the various states).

Example

navigator.mozPower.addWakeLockListener(function (name, stat) {
  console.log("The lock state for the resource '" + name + "' is: " + stat);
});

Specifications

Not part of any specification.

See also

Document Tags and Contributors

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