[sensors] Define tasks for state changes

alexshalamov has just created a new issue for https://github.com/w3c/sensors:

== Define tasks for state changes ==
At the moment, spec has [few](https://w3c.github.io/sensors/#sensor-start) [places](https://w3c.github.io/sensors/#sensor-stop) where state is updated without task or (state change + simple event) is fired outside of task execution scope.
 
According to [recommendations from Anne](https://github.com/w3c/sensors/issues/215#issuecomment-304396775) state changes should be performed from task.
 
Also, spec must define what happens to tasks that are in the queue, e.g., whether those can be cancelled (removed from queue).
 
Example 1:
 
Sensor is active and update reading is queued, then error occurs and page loses visibility.
Now we have 3 tasks in queue [update sensor reading, onerror, state change to idle].

Should we process queue and don’t allow new tasks to be added from sensor? Should we 'suspend' tasks and wait when page gains visibility and then process tasks?
 
Example 2:
 
Sensor is is active, update sensor reading scheduled, then stop is called.

Two tasks in queue [update sensor reading, change state to idle]
Should we cancel queued update?


Please view or discuss this issue at https://github.com/w3c/sensors/issues/218 using your GitHub account

Received on Saturday, 27 May 2017 11:20:54 UTC