WakeLockSentinel extension type
The WakeLockSentinel
interface of the
Screen Wake Lock API
can be used to monitor the status of the platform screen wake lock, and
manually release the lock when needed.
The screen wake lock prevents device screens from dimming or locking when an application needs to keep running.
A screen wake lock is requested using the WakeLock.request method, which
returns a Promise
that fulfills with a WakeLockSentinel
object if the
lock is granted.
An acquired screen wake lock can be released manually via the
WakeLockSentinel.release method, or automatically via the platform screen
wake lock. The latter may occur if the document becomes inactive or loses
visibility, if the device is low on power, or if the user turns on a power
save mode.
A released WakeLockSentinel
cannot be re-used: a new sentinel must be be
requested using WakeLock.request if a new lock is needed.
Releasing all WakeLockSentinel
instances of a given wake lock type will
cause the underlying platform wake lock to be released.
An event is fired at the WakeLockSentinel
if the platform lock is
released, allowing applications to configure their UI, and re-request the
lock if needed.
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- onrelease ↔ EventHandler?
-
getter/setter pair
- released → bool
-
The
released
read-only property of the WakeLockSentinel interface returns a boolean that indicates whether a WakeLockSentinel has been released.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → WakeLockType
-
The
type
read-only property of the WakeLockSentinel interface returns a string representation of the currently acquired WakeLockSentinel type.no setter
Methods
-
addEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
addEventListener()
method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.inherited -
dispatchEvent(
Event event) → bool -
The
dispatchEvent()
method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually withdispatchEvent()
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
release(
) → JSPromise< JSAny?> -
The
release()
method of the WakeLockSentinel interface releases the WakeLockSentinel, returning aPromise
that is resolved once the sentinel has been successfully released. -
removeEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
removeEventListener()
method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited