[web-bluetooth] Improve the getAvailability() design

jyasskin has just created a new issue for 
https://github.com/WebBluetoothCG/web-bluetooth:

== Improve the getAvailability() design ==
@slightlyoff suggested that because 
[`getAvailability()`](https://webbluetoothcg.github.io/web-bluetooth/#availability)
 works slightly differently from 
[`PresentationRequest.getAvailability()`](https://w3c.github.io/presentation-api/#interface-presentationrequest),
 we should consider naming them differently. I believe he's going to 
take the general question of availability queries to the TAG, so we 
should wait to commit to something here until they take a look.

Because we tend to want the same code to run in both 
`getAvailability().then(<here>)` and 
`navigator.bluetooth.addEventListener('availabilitychanged', <here>)`,
 it might make more sense to use a unified `watchAvailability(...)` 
function that works like an event listener but 1) is guaranteed to be 
called at least once, and 2) can specify registration to have 
side-effects, which event listeners can't.

@mfoltzgoogle @domenic @tabatkins

Please view or discuss this issue at 
https://github.com/WebBluetoothCG/web-bluetooth/issues/307 using your 
GitHub account

Received on Thursday, 6 October 2016 22:13:29 UTC