Re: [web-bluetooth] Consider watchAdvertisements value (#478)

I think when I wrote this, I was trying to ensure that
1. Synchronously when `unwatch` is called, advertisement events stop being delivered to the device. That's achieved by https://webbluetoothcg.github.io/web-bluetooth/#advertising-event-algorithm:~:text=If%20deviceObj.watchingAdvertisements%20is%20false,%20abort%20these%20sub-steps.
2. When `watch` is called, advertisement events only start being delivered after the promise returns.

I suspect the right fix is say that the `watch` steps [abort when](https://infra.spec.whatwg.org/#algorithm-conditional-abort) `unwatch` is called on the same device. 

There's still a race between the instructions to the OS, which might be fixed by putting both in the same [parallel queue](https://html.spec.whatwg.org/multipage/infrastructure.html#parallel-queue). The Web Bluetooth spec ought to be using those in lots of places to avoid internal races, but they post-date when I wrote the spec.




-- 
GitHub Notification of comment by jyasskin
Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/pull/478#issuecomment-596687534 using your GitHub account

Received on Monday, 9 March 2020 18:01:56 UTC