W3cubDocs

/Web APIs

WakeLockSentinel: release event

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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 looses visibility, if the device is low on power or the user turns on a power save mode.

Syntax

Use the event name in methods like addEventListener(), or set an event-handler property.

js

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

onrelease = (event) => {};

Event type

A generic Event.

Examples

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

js

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

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
release_event 84 84 No No 70 16.4 84 84 No 60 16.4 14.0

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WakeLockSentinel/release_event