- The [[PERMISSIONS]] API provides a uniform way for websites to request
- permissions from users and query which permissions they have.
-
-
- A user agent can deny a wake lock of a
- particular wake lock type for a particular {{Document}} by any
- implementation-specific reason, such as platform setting or user
- preference.
-
-
- It is RECOMMENDED that a user agent show some form of unobtrusive
- notification that informs the user when a wake lock is active, as well
- as provides the user with the means to [=screen wake lock permission
- revocation algorithm|block=] the ongoing operation, or simply dismiss
- the notification.
-
-
-
- The `"screen-wake-lock"` powerful feature
-
-
- The `"screen-wake-lock"` powerful feature enables the
- capability defined by this specification.
-
-
-
-
- Permission algorithms
-
-
- The `"screen-wake-lock"` powerful feature defines a [=powerful
- feature/permission revocation algorithm=]. To invoke the Screen
- Wake Lock permission revocation algorithm, run these steps:
-
-
-
Let |document:Document| be the [=current global object=]'s
- [=associated Document=].
-
-
Let |lockList| be
- |document|.{{Document/[[ActiveLocks]]}}["`screen`"].
-
-
[=list/For each=] |lock:WakeLockSentinel| in |lockList|:
-
-
Run release a wake lock with |document|, |lock|, and
- {{WakeLockType/"screen"}}.
-
-
-
-
-
-
Concepts
@@ -309,11 +251,19 @@
The request() method
- The request(|type:WakeLockType|) method steps are:
+ The `request(|type:WakeLockType|)` method steps are:
Let |document:Document| be [=this=]'s [=relevant global
- object=]'s [=associated Document=].
+ object=]'s [=associated `Document`=].
+
+
If the |document|'s [=Document/browsing context=] is `null`,
+ return [=a promise rejected with=] {{"NotAllowedError"}}
+ {{DOMException}}.
+
+
If
+ |document| is not [=Document/fully active=], return [=a promise
+ rejected with=] with a {{"NotAllowedError"}} {{DOMException}}.
If |document| is not [=allowed to use=] the [=policy-controlled
@@ -325,80 +275,33 @@
|document|, return [=a promise rejected with=] a
{{"NotAllowedError"}} {{DOMException}}.
-
If the |document|'s [=Document/browsing context=] is `null`,
- return [=a promise rejected with=] {{"NotAllowedError"}}
- {{DOMException}}.
-
-
If
- |document| is not [=Document/fully active=], return [=a promise
- rejected with=] with a {{"NotAllowedError"}} {{DOMException}}.
-
If
|document|'s [=Document/visibility state=] is "`hidden`", return [=a
promise rejected with=] {{"NotAllowedError"}} {{DOMException}}.
Let |lock:WakeLockSentinel| be a new {{WakeLockSentinel}}
- object with its {{WakeLockSentinel/type}} attribute set to
- |type|.
-
-
[=List/Append=] |lock| to
- |document|.{{Document/[[ActiveLocks]]}}["`screen`"].
-
-
Resolve |promise| with |lock|.
-
-
+
[=List/Append=] |lock| to
+ |document|.{{Document/[[ActiveLocks]]}}["`screen`"].
+
+
[=Queue a global task=] to [=resolve=] |promise| with |lock|.
@@ -598,8 +501,8 @@
MUST treat wake lock acquisition as advisory-only.
- Conversely, the user agent releases the wake lock by requesting the
+ Conversely, the user agent can release the wake lock by requesting the
underlying operating system to no longer apply the wake lock. The lock
is considered released only when the request to the operating system
succeeds.
@@ -721,20 +624,22 @@
Remove |lock| from
|document|.{{Document/[[ActiveLocks]]}}[|type|].
+
[=Queue a task=] on the [=screen wake lock task source=] to:
+
+
Set |lock|'s {{WakeLockSentinel/[[Released]]}} to `true`.
+
+
[=Fire an event=] named "`release`" at |lock|.
+
+
+
If |document|.{{Document/[[ActiveLocks]]}}[|type|] [=list/is
empty=], then run the following steps in parallel:
-
Ask the underlying operating system to release the wake lock
- of type |type| and let |success:boolean| be `true` if the
- operation succeeded, or else `false`.
+
Ask the underlying operating system to [=release the wake
+ lock=].
-
If |success| is `true` and |type| is `"screen"` run the
- following:
-
-
Reset the platform-specific inactivity timer after which
- the screen is actually turned off.
-
-
+
If the operation succeeds, reset the platform-specific
+ inactivity timer after which the screen is actually turned off.
-
Set |lock|'s {{WakeLockSentinel/[[Released]]}} to `true`.
-
application is having a negative energy impact on the device, and allow
them to take action if so desired.
+
+ A user agent MAY deny a wake lock of a
+ particular wake lock type for a particular {{Document}} by any
+ implementation-specific reason, such as platform setting or user
+ preference.
+