Re: [w3c/screen-orientation] Editorial: Example 2 (#134)

marcoscaceres requested changes on this pull request.

Suggestions we discussed on Slack... 

> @@ -554,16 +554,23 @@ <h2>
 &lt;/button&gt;
 </pre>
       <p>
-        This example waits to be fullscreen before locking the screen
-        orientation and starting.
+        This example waits to be fullscreen and locked to landscape before

```suggestion
        This example waits for fullscreen, then locks to landscape before
```

> @@ -554,16 +554,23 @@ <h2>
 &lt;/button&gt;
 </pre>
       <p>
-        This example waits to be fullscreen before locking the screen
-        orientation and starting.
+        This example waits to be fullscreen and locked to landscape before
+        running <code>ready()</code>.

```suggestion
        calling <code>ready()</code>.
```

>        </p>
       <pre class='example html'>
 &lt;script&gt;
-  var start = function() {
-    document.onfullscreenchange = function() {
-      screen.orientation.lock('natural').then(startInternal);
-    }
-    document.documentElement.requestFullscreen();
+  function ready(){
+    console.log("Now full screen and ready to start, locked to " + screen.orientation.type);
+  }
+
+  async function start() {
+    const promiseToFullScreen = new Promise(resolve =&gt;

As we discussed, we don't need this anymore :) Similarly if it's still in other examples. 

>        </p>
       <pre class='example html'>
 &lt;script&gt;
-  var start = function() {
-    document.onfullscreenchange = function() {
-      screen.orientation.lock('natural').then(startInternal);
-    }
-    document.documentElement.requestFullscreen();
+  function ready(){
+    console.log("Now full screen and ready to start, locked to " + screen.orientation.type);
+  }
+
+  async function start() {
+    const promiseToFullScreen = new Promise(resolve =&gt;
+      document.addEventListener("fullscreenchange", resolve)
+    );
+    await document.documentElement.requestFullscreen();
+    await promiseToFullScreen;

And this one. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/screen-orientation/pull/134#pullrequestreview-193075436

Received on Wednesday, 16 January 2019 11:09:51 UTC