PowerManager.addWakeLockListener

Nos bénévoles n'ont pas encore traduit cet article en Français. Aidez-nous à réaliser cette tâche !

« DOM Reference

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 certified applications only.

Summary

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

Syntax

PowerManager.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);
});

Specification

Not part of any specification.

See also

Étiquettes et contributeurs liés au document

Contributeurs ayant participé à cette page : Sheppy, kscarfone, Jeremie
Dernière mise à jour par : kscarfone,