Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.26 KB

File metadata and controls

52 lines (37 loc) · 1.26 KB
title slug page-type status browser-compat
WakeLockSentinel.released
Web/API/WakeLockSentinel/released
web-api-instance-property
experimental
api.WakeLockSentinel.released

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

The read-only released property of the {{domxref("WakeLockSentinel")}} interface returns a boolean that indicates whether a {{domxref("WakeLockSentinel")}} has been released yet.

Syntax

const released = sentinel.released

Value

A boolean value, that is false until the {{domxref("WakeLockSentinel")}} has been released (either through a call to {{domxref("WakeLockSentinel.release()")}} or because the lock has been released automatically) and the {{domxref("WakeLockSentinel/release_event", "release")}} event has been emitted, after which it becomes true and no longer changes.

Examples

This example shows how released's value changes within a {{domxref("WakeLockSentinel")}}'s life cycle.

const sentinel = await navigator.wakeLock.request('screen');
console.log(sentinel.released);  // Logs "false"

sentinel.onrelease = () => {
  console.log(sentinel.released);  // Logs "true"
};

await sentinel.release();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}