mozilla
Your Search Results

    PowerManager.addWakeLockListener()

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

    Document Tags and Contributors

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