WakeLockSentinel.onrelease

Draft: This page is not complete.

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

The onrelease property of the WakeLockSentinel 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.

This interface inherits from the Event interface.

Syntax

wakeLockSentinel.onrelease = function(event) {...}

Examples

This example updates the UI should the wake lock be released.

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
onrelease
84
84
No
No
Yes
No
84
84
No
Yes
No
14.0

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