Re: [w3c/permissions] chore(examples): Modernize JS examples (#101)

> -                                             deviceId: devices[0].deviceId})
> -      })
> -      .then(function(result) {
> -         console.log('Camera permission to first camera is ' + result.state);
> -      }
> -      .catch(err => console.log('Bad things happened: ' + err.name));
> -    </script>
> +navigator.mediaDevices
> +  .enumerateDevices()
> +  // filter out just video inputs
> +  .then(
> +    devices => devices.filter(({ kind }) => kind === "videoinput")
> +  )
> +  // get the deviceId of first camera, create query object
> +  .then(
> +    ([{ deviceId }]) => ({ name: "camera", deviceId })

It seems unnecessarily verbose to create the query object and call `query()` in two separate `.then()` steps. Combine them?

---
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/permissions/pull/101/files/470ed130ca7c83f19116181ac87726635a43802b#r70289278

Received on Monday, 11 July 2016 16:20:00 UTC