title | slug | page-type | status | browser-compat | |
---|---|---|---|---|---|
WakeLockSentinel.release() |
Web/API/WakeLockSentinel/release |
web-api-instance-method |
|
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.
release()
None.
Returns a {{jsxref("Promise")}} that resolves with undefined
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.
In this example, when a user clicks a button the {{domxref("WakeLockSentinel")}} is released.
wakeLockOffButton.addEventListener('click', () => {
WakeLockSentinel.release();
})
{{Specifications}}
{{Compat}}
- {{DOMxRef("WakeLockSentinel")}}
- {{DOMxRef("WakeLock.request", "navigator.wakeLock.request()")}}