Re: [sensors] Garbage collection behavior unclear in Generic Sensor spec

@anssiko, thank you for the prompt reply.

In the above example, when `a.onactivate = ...` executes, the instance may be in either the `activating` or `activated` state. In either case, it is eligible to be collected since there is no `onactivate` or `onreading` handler. Consequently, it will be deactivated and not make any readings. That is clear from the text.

If the state is `activating`, installing an `onactivate`handler makes it ineligible for collection. If the state is `activated` installing the `onactivate` handler does not make in ineligible for connection. In that case, the `onreading`handler is necessary. Consider the case where `onreading` is installed in `onactivate`. In that case, given a sensor implementation that does not progress from `idle` to `activated` in its constructor, whether `onactivate` is called depends on the garbage collector timing.

It also seems that readings are only taken if an `onreading`  handler is present. That is possibly unexpected by the API client as `start` succeeds when no `onreading` handler is present and the sensor reading values are readily available to poll on the sensor instance without the need for a callback.

Forgive me if I've not understand the specification well. It is sufficiently complex that it takes time to fit the pieces together.


-- 
GitHub Notification of comment by phoddie
Please view or discuss this issue at https://github.com/w3c/sensors/issues/372#issuecomment-422884037 using your GitHub account

Received on Wednesday, 19 September 2018 17:12:30 UTC