Open Ms2ger opened 1 year ago
The intent of this text is to attach these steps to the "loss of visibility" or "loss of full activity" event on any document. It feels like it should be something like,
When the user agent determines that a document is no longer fully active, it must run these steps:
- Let document be that document.
- ...
The abort all active watchAdvertisements algorithm should really be taking the document (or the document's navigator.bluetooth
instance) as a parameter.
Does that make sense? Can you suggest the proper way to create such an event listener?
Thanks! The <object>
spec does something similar:
Whenever one of the following conditions occur: ...
- the element's node document changes whether it is fully active,
... (do some stuff)
so I'm guessing something like what you quoted would be fine.
CC @annevk
Yeah, probably. Getting some of this formalized better is a long-standing issue of the HTML standard.
What do you think of this?
When a document's visibility state changes,
- Let document be the document.
- Let global be document's relevant global object.
- Queue a task on the Bluetooth event source with global and the following steps,
- If document’s visibility state is not "visible", then abort all active watchAdvertisements operations on global.
I'm unsure when I want to use the "document" concept vs. the "Document" interface.
To get the Bluetooth
instance from a document it seems like I should go through the associated Navigator (given global) and define a similar "associated Bluetooth" concept which is used in the getter steps for the "bluetooth" attribute in the Navigator partial interface.
https://webbluetoothcg.github.io/web-bluetooth/#handling-visibility-change https://webbluetoothcg.github.io/web-bluetooth/#handling-full-activity-loss
There's two occurrences of "current settings object's relevant global object" in the spec, but a settings object doesn't have a "relevant global object", only a "global object".
Using "current global object" is also an option.
However, I'm not sure how using the "current" anything works here.