W3C home > Mailing lists > Public > public-web-bluetooth-log@w3.org > January 2016

Re: [web-bluetooth] Should `requestDevice` allow choosing more than 1 device?

From: François Beaufort via GitHub <sysbot+gh@w3.org>
Date: Wed, 06 Jan 2016 10:14:31 +0000
To: public-web-bluetooth-log@w3.org
Message-ID: <issue_comment.created-169284024-1452075271-sysbot+gh@w3.org>
Using the Permissions API would make this trivial. See 
https://lists.w3.org/Archives/Public/public-web-bluetooth/2015Dec/0007.html

```js
permissions.request({ name: 'bluetooth', filters: [{ name: 'Jugglow' 
}], multiple: true })
.then(result => {
  if (result.state != 'granted') {
    return;
  }
  // Let's try to connect to all devices...
  return Promise.all(result.devices.map(device => connectDevice));
});

function connectDevice(device) {
  return device.connectGATT()
  .then(...)
}
```

-- 
GitHub Notification of comment by beaufortfrancois
Please view or discuss this issue at 
https://github.com/WebBluetoothCG/web-bluetooth/issues/42#issuecomment-169284024
 using your GitHub account
Received on Wednesday, 6 January 2016 10:14:34 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 6 January 2016 10:14:34 UTC