-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sensor objects fire 'change' event considering their own frequency hint #210
Conversation
gentle ping for review |
I won't be able to get to this right away. And I'd like to review it personally before merging it in. Sorry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one issue identified.
index.bs
Outdated
1. Abort these steps. | ||
1. Let |reportingInterval| be the result of 1 / |reportingFrequency|. | ||
1. Let |timestampDelta| be the result of [=latest reading=]["timestamp"] - |lastReportedTimestamp|. | ||
1. If |timestampDelta| is less than or equal to |reportingInterval| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/is less than or equal to/is greater than or equal to/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch!
index.bs
Outdated
1. Abort these steps. | ||
1. Let |reportingFrequency| be result of invoking the [=Find the reporting frequency of a Sensor=] | ||
abstract operation. | ||
1. If |reportingFrequency| is not set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Find the reporting frequency of a Sensor
algorithm always returns something, so, branch If |reportingFrequency| is not set
should never be executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Find the reporting frequency of a Sensor
operation can return null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:) not set =! set to null
Maybe If |reportingFrequency| is null
? wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep :)
70bd09c
to
795b489
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
795b489
to
352d8f5
Compare
index.bs
Outdated
passing it |sensor_instance| as argument. | ||
1. Abort these steps. | ||
1. Let |deferUpdateTime| be the result of |reportingInterval| - |timestampDelta|. | ||
1. User agent must defer queueing a task to run the [=Notify Sensor Object about new reading=] abstract |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a way to cancel this, e.g., if stop() is called?
Queuing task == sensor_task_source.task_queue.add(task);
Do we need to save 'deferred notify'
and then, if stop is called, we would not queue a task?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the delta to the previous, LGTM with minor nits.
index.bs
Outdated
@@ -1175,6 +1175,9 @@ Gets the {{Error}} object passed to {{SensorErrorEventInit}}. | |||
value of |reading| to see if there's a change | |||
that needs to be propagated. | |||
1. Unset |sensor|’s [=reporting flag=]. | |||
1. [=set/For each=] |s| of |activated_sensors|, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To iterate over a list, use "For each X in Y".
index.bs
Outdated
@@ -1175,6 +1175,9 @@ Gets the {{Error}} object passed to {{SensorErrorEventInit}}. | |||
value of |reading| to see if there's a change | |||
that needs to be propagated. | |||
1. Unset |sensor|’s [=reporting flag=]. | |||
1. [=set/For each=] |s| of |activated_sensors|, | |||
1. Invoke the [=Report Latest Reading updated=] abstract operation, | |||
passing it |s| as argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as an argument
@pozdnyakov: I did take a look. I'd like to clean-up parts of the spec before integrating this. I also don't think this is the cleanest way to do this, tbh. Let me come back to it later. |
76b2946
to
30c872e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the specification has clear definition for sensor task source, I think this PR can be merged.
LGTM. |
@alexshalamov @pozdnyakov, there has been plenty of time (>1 month) for the group to review this PR, and all feedback that suggests concrete changes have been incorporated. You should be able to merge this now. |
…its individual frequency hint. Thus we achieve that appearance of a new Sensor instance with a higher frequency hint does not affect the 'onchange' notification of the existing Sensor instances of the same type.
30c872e
to
dcc6018
Compare
dcc6018
to
70e9f8f
Compare
…uency hint" This relands w3c#210
Fixes #152. Each Sensor instance fires 'change' event considering its individual
frequency hint. Thus we achieve that appearance of a new Sensor instance with a
higher frequency hint does not affect the 'onchange' notification of the existing
Sensor instances of the same type.
Preview | Diff