Skip to content

Commit 9282aad

Browse files
author
Marcos Cáceres
committed
BREAKING CHANGE: unlock() returns a pormise
1 parent da743fe commit 9282aad

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

index.html

Lines changed: 11 additions & 13 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

0 commit comments

Comments
 (0)