Re: [web-bluetooth] discussion: is there possibility to change getAvailability() be sync API (#459)

You're right, the user can block permissions for a site, and the `availabilitychanged` event can be used to detect when it is available again. But the [Permissions API integration](https://webbluetoothcg.github.io/web-bluetooth/#bluetoothpermissionresult) can also be used by setting the `onchange` handler on the `PermissionStatus`. I think it makes more sense to check the permission using that API.

In the discussion that we had, one of the things considered was only having the `availabilitychanged` event, implementing it such that an event is guaranteed to be fired when you install a listener for it, and removing `getAvailability()`. This would address the weirdness brought up by @yorkie, since developers would only need to use the one API. However, we decided against that because again the potential use of the API seems low, and `getAvailability()` is already shipping in Chrome 78.

I definitely do agree that we should just have one API to reduce the potential bugginess from using the two APIs. Let me know what you think, would it be better to have just one API or both?

-- 
GitHub Notification of comment by odejesush
Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/459#issuecomment-546433587 using your GitHub account

Received on Friday, 25 October 2019 17:04:17 UTC