Re: [web-bluetooth] Say what to do when the system has no Bluetooth adapter or it's off.

Roughly. I'm not sure of the name of the getter and member, and 
whether we can have people use `Object.observe()` on the member 
instead of the `onchange` event. I believe we can forbid the platform 
from rejecting the resulting promise (just return `false` if the 
user's forbidden access). So we might wind up with:

```javascript
navigator.bluetooth.hasAdapter()
.then(adapterInfo => {
  // adapterInfo.value will be kept up-to-date by the UA as long as 
the availability
  // object is alive. It is advised for web developers to discard the 
object as soon 
  // as it's not needed.
  handleBluetoothAvailabilityChange(adapterInfo.value);
  Object.observe(adapterInfo, () => {
    handleBluetoothAvailabilityChange(adapterInfo.value);
  });
});
```

Or

```javascript
navigator.bluetooth.getAvailability().then(availability => 
use(availability.available))
```

`getAvailability()` extends to a future where we might give explicit 
access to particular adapters, or tell developers whether BT is 
disabled, or whatever. `hasAdapter()` is more targeted, which avoids 
getting hopes up, and lets us optimize more for the specific 
information the developers are getting.

-- 
GitHub Notif of comment by jyasskin
See 
https://github.com/WebBluetoothCG/web-bluetooth/issues/127#issuecomment-123442443

Received on Tuesday, 21 July 2015 18:57:09 UTC