Skip to content

Commit

Permalink
Make "type" an optional parameter for WakeLock.request().
Browse files Browse the repository at this point in the history
And make it default to "screen". Existing code continues to work, while new
code can also call `navigator.wakeLock.request()` to request a screen wake
lock.

Issues w3c#253, w3c#255 and w3c#288 indicate that there is a preference for making
`type` an optional parameter that just got overlooked.
  • Loading branch information
rakuco committed Sep 30, 2020
1 parent 0b715f7 commit b27afee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions explainer.md
Expand Up @@ -55,8 +55,9 @@ if (lock.released === false) {

### Requesting permission to use WakeLocks
To use the API, one must request access via
`navigator.wakeLock.request("screen")`. This returns a promise which, if
allowed by the user, resolves with a `WakeLockSentinel`.
`navigator.wakeLock.request("screen")` (_"screen"_ is optional). This
returns a promise which, if allowed by the user, resolves with a
`WakeLockSentinel`.

```js
let sentinel;
Expand Down
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -326,7 +326,7 @@ <h2>
<pre class="idl">
[SecureContext, Exposed=(Window)]
interface WakeLock {
Promise&lt;WakeLockSentinel&gt; request(WakeLockType type);
Promise&lt;WakeLockSentinel&gt; request(optional WakeLockType type = "screen");
};
</pre>
<section>
Expand Down

0 comments on commit b27afee

Please sign in to comment.