MDN self-hosted library · e01.org

WakeLockSentinel: release event

Screen Wake Lock API

Screen Wake Lock API

The release event of the WakeLockSentinel interface is fired when the sentinel object's handle has been released.

A WakeLockSentinel can be released manually via the release() method, or automatically via the platform wake lock. This can happen if the document becomes inactive or loses visibility, if the device is low on power or the user turns on a power save mode.

Syntax

Use the event name in addEventListener():

addEventListener("release", (event) => { })

Alternatively, assign to the event handler property of the interface:

onrelease = (event) => { }

Event type

A generic Event.

Examples

This example updates the UI if the wake lock is released.

wakeLock.addEventListener("release", () => {
  // if wake lock is released alter the UI accordingly
  statusElement.textContent = "Wake Lock has been released";
});

Specifications

Browser compatibility

See also