Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.18 KB

File metadata and controls

58 lines (39 loc) · 1.18 KB
title slug page-type status browser-compat
WakeLockSentinel.release()
Web/API/WakeLockSentinel/release
web-api-instance-method
experimental
api.WakeLockSentinel.release

{{APIRef("Screen Wake Lock API")}}{{SecureContext_Header}}{{SeeCompatTable}}

The release() method of the {{domxref("WakeLockSentinel")}} interface releases the {{domxref("WakeLockSentinel")}}, returning a {{jsxref("Promise")}} that is resolved once the sentinel has been successfully released.

Syntax

release()

Parameters

None.

Return value

Returns a {{jsxref("Promise")}} that resolves with undefined

Exceptions

No exceptions are thrown. You should always listen for the {{domxref("WakeLockSentinel/release_event", "release")}} event to check if a wake lock has been released.

Examples

In this example, when a user clicks a button the {{domxref("WakeLockSentinel")}} is released.

wakeLockOffButton.addEventListener('click', () => {
  WakeLockSentinel.release();
})

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{DOMxRef("WakeLockSentinel")}}
  • {{DOMxRef("WakeLock.request", "navigator.wakeLock.request()")}}