Re: [mediacapture-main] format & fixup Example code

Script output:

```
Checking ../mediacapture-main/getusermedia.html
Example_1: Passed
Example_2: Passed
Example_3: Passed
Example_4: Passed
Example_5: Passed
Example_6: Passed
Example_7: Passed
Example_8: Passed
Example_9: Passed
=== Example_10 ===

01  temp = {
02    frameRate: {min: 1.0, max: 60.0},
03    facingMode: [ "user", "left" ]
04  };
=== Linter output ===

/home/eadaber/repos/w3c/check-examples/Example_10.js
  3:15  error  There should be no space after '['   array-bracket-spacing
  3:32  error  There should be no space before ']'  array-bracket-spacing

✖ 2 problems (2 errors, 0 warnings)
  2 errors, 0 warnings potentially fixable with the `--fix` option.


Example_10: Linter process exited with code 1

Example_11: Passed
Example_12: Passed
=== Example_13 ===

01  <button id="startBtn">Start</button>
02  <script>
03  const startBtn = document.getElementById('startBtn');
04  
05  startBtn.onclick = async () => {
06    try {
07      startBtn.disabled = true;
08      const constraints = {
09        audio: true,
10        video: true
11      };
12  
13      const stream = await navigator.mediaDevices.getUserMedia(constraints);
14  
15      for (let track of stream.getTracks()) {
16        track.onended = () => {
17          startBtn.disabled = stream.getTracks().some(t => t.readyState == 'live');
18        }
19      };
20    } catch(err) {
21      console.error(err)
22    }
23  };
24  </script>
=== Linter output ===

/home/eadaber/repos/w3c/check-examples/Example_13.html
  17:53  error  Expected parentheses around arrow function argument  arrow-parens
  18:8   error  Missing semicolon                                    semi
  20:5   error  Expected space(s) after "catch"                      keyword-spacing
  21:23  error  Missing semicolon                                    semi

✖ 4 problems (4 errors, 0 warnings)
  4 errors, 0 warnings potentially fixable with the `--fix` option.


Example_13: Linter process exited with code 1

=== Example_14 ===

01  <script>
02  window.onload = async () => {
03    const video = document.getElementById('monitor');
04    const canvas = document.getElementById('photo');
05    const shutter = document.getElementById('shutter');
06  
07    try {
08      video.srcObject = await navigator.mediaDevices.getUserMedia({video: true});
09  
10      await new Promise(resolve => video.onloadedmetadata = resolve);
11      canvas.width = video.videoWidth;
12      canvas.height = video.videoHeight;
13      document.getElementById('splash').hidden = true;
14      document.getElementById('app').hidden = false;
15  
16      shutter.onclick = () => canvas.getContext('2d').drawImage(video, 0, 0);
17    } catch (err) {
18      console.error(err)
19    }
20  };
21  </script>
22  
23  <h1>Snapshot Kiosk</h1>
24  
25  <section id="splash">
26    <p id="errorMessage">Loading...</p>
27  </section>
28  
29  <section id="app" hidden>
30    <video id="monitor" autoplay></video>
31    <button id="shutter">&#x1F4F7;</button>
32    <canvas id="photo"></canvas>
33  </section>
=== Linter output ===

/home/eadaber/repos/w3c/check-examples/Example_14.html
  10:23  error  Expected parentheses around arrow function argument  arrow-parens
  18:23  error  Missing semicolon                                    semi

✖ 2 problems (2 errors, 0 warnings)
  2 errors, 0 warnings potentially fixable with the `--fix` option.


Example_14: Linter process exited with code 1

```

-- 
GitHub Notification of comment by adam-be
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/pull/486#issuecomment-338875315 using your GitHub account

Received on Tuesday, 24 October 2017 05:07:57 UTC