WakeLockOptions Class

The host hooks of the Screen Wake Lock API (https://w3c.github.io/screen-wake-lock/, BrowsingContextOptions.WakeLock).

public sealed class WakeLockOptions

Constructors

NameDescription
WakeLockOptions()

WakeLockOptions()

public WakeLockOptions()

No documentation is available.

Properties

NameDescription
AcquireGets or sets the callback that asks the operating system to acquire the wake lock (https://w3c.github.io/screen-wake-lock/#dfn-acquire-a-wake-lock), e.g. to keep the screen on: it is called when a document acquires its first lock of a type (navigator.wakeLock.request()). The library checks the document (fully active, visible, allowed by the screen-wake-lock permissions policy) and the screen-wake-lock permission (see BrowsingContextOptions.Permissions and BrowsingContextOptions.RequestPermission) before calling it. The result of the request to the operating system is not reported to the document (the lock is advisory). The callback is invoked on the thread of the event loop, and must not block it. The default is null: nothing is kept on, but the documents get their locks. The first argument is the context of the window (see CallbackContext): its CallbackContext.Window is never null.
ReleaseGets or sets the callback that asks the operating system to release the wake lock (https://w3c.github.io/screen-wake-lock/#dfn-release-a-wake-lock): it is called when the last lock of a type of a document is released (WakeLockSentinel.release(), the document becomes hidden or is no longer fully active). The callback is invoked on the thread of the event loop. The default is null. The first argument is the context of the window (see CallbackContext): its CallbackContext.Window is never null.

Gets or sets the callback that asks the operating system to acquire the wake lock (https://w3c.github.io/screen-wake-lock/#dfn-acquire-a-wake-lock), e.g. to keep the screen on: it is called when a document acquires its first lock of a type (navigator.wakeLock.request()). The library checks the document (fully active, visible, allowed by the screen-wake-lock permissions policy) and the screen-wake-lock permission (see BrowsingContextOptions.Permissions and BrowsingContextOptions.RequestPermission) before calling it. The result of the request to the operating system is not reported to the document (the lock is advisory). The callback is invoked on the thread of the event loop, and must not block it. The default is null: nothing is kept on, but the documents get their locks. The first argument is the context of the window (see CallbackContext): its CallbackContext.Window is never null.

public Action<CallbackContext, WakeLockType>? Acquire { get; init; }

Gets or sets the callback that asks the operating system to release the wake lock (https://w3c.github.io/screen-wake-lock/#dfn-release-a-wake-lock): it is called when the last lock of a type of a document is released (WakeLockSentinel.release(), the document becomes hidden or is no longer fully active). The callback is invoked on the thread of the event loop. The default is null. The first argument is the context of the window (see CallbackContext): its CallbackContext.Window is never null.

public Action<CallbackContext, WakeLockType>? Release { get; init; }