Skip to content

Commit 9d9468d

Browse files
author
Marcos Cáceres
committed
BREAKING CHANGE: unlock() returns a pormise
1 parent 1a92f51 commit 9d9468d

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

index.html

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,17 @@ <h2>
142142
show();
143143
updateDetails(document.getElementById("button"));
144144
});
145+
146+
async function doUnlock() {
147+
await screen.orientation.unlock();
148+
await document.exitFullscreen();
149+
}
145150
&lt;/script&gt;
146151

147152
&lt;button onclick="rotate(this)" id="button"&gt;
148153
Lock
149154
&lt;/button&gt;
150-
&lt;button onclick="screen.orientation.unlock()"&gt;
155+
&lt;button onclick="doUnlock()"&gt;
151156
Unlock
152157
&lt;/button&gt;
153158
</pre>
@@ -256,7 +261,7 @@ <h2>
256261
[Exposed=Window]
257262
interface ScreenOrientation : EventTarget {
258263
Promise&lt;void&gt; lock(OrientationLockType orientation);
259-
void unlock();
264+
Promise&lt;void&gt; unlock();
260265
readonly attribute OrientationType type;
261266
readonly attribute unsigned short angle;
262267
attribute EventHandler onchange;
@@ -324,17 +329,9 @@ <h2>
324329
</h2>
325330
<p>
326331
When the {{unlock()}} method is invoked, the <a>user agent</a> MUST
327-
run the steps to <a>lock the orientation</a> of the <a>responsible
328-
document</a> to its <a>default orientation</a>.
332+
run the steps to <a>apply an orientation lock</a> of the
333+
<a>responsible document</a> to its <a>default orientation</a>.
329334
</p>
330-
<p class='note' title="Why does unlock() not return a promise?">
331-
{{unlock()}} does not return a promise because it is equivalent to
332-
locking to the <a>default orientation</a> which might or might not be
333-
known by the <a>user agent</a>. Hence, the <a>user agent</a> can not
334-
predict what the new orientation is going to be and even if it is
335-
going to change at all.
336-
</p>
337-
<div class="issue" data-number="104"></div>
338335
</section>
339336
<section>
340337
<h2>
@@ -827,7 +824,8 @@ <h2>
827824
</h2>
828825
<p>
829826
The steps to <dfn>apply an orientation lock</dfn> to a
830-
<a>document</a> using |orientation| are as follows:
827+
<a>document</a> using |orientation:OrientationLockType| are as
828+
follows:
831829
</p>
832830
<ol>
833831
<li>If the <a>user agent</a> does not support locking the screen
@@ -864,7 +862,7 @@ <h2>
864862
</ol>
865863
</li>
866864
<li data-tests="lock-basic.html">Let |orientations| be an empty
867-
list.
865+
<a>list</a>.
868866
</li>
869867
<li>Depending on |orientation| value, do the following:
870868
<dl>
@@ -915,8 +913,8 @@ <h2>
915913
</li>
916914
<li>If locking the orientation did not result in a change of
917915
orientation, as part of the next <a>animation frame task</a>,
918-
resolve |pending-promise| with `undefined` and set |
919-
pending-promise| to `null`.
916+
resolve {{[[orientationPendingPromise]]}} with `undefined` and
917+
set {{[[orientationPendingPromise]]}} to `null`.
920918
</li>
921919
</ol>
922920
</li>

0 commit comments

Comments
 (0)