-
Notifications
You must be signed in to change notification settings - Fork 17
read() will resolve geolocation promise only if notify new reading is invoked #19
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
Comments
Such a test should use
When you follow the definitions: latest reading -> sensor readings -> raw sensor readings:
Most if not all use cases require the timestamp to indicate the actual time when the reading was obtained, and not when the event fires. Web developers can get a timestamp that is correlated with event firing via @Honry to check if we should add a test case for this. I don't see such a test case in https://github.com/w3c/web-platform-tests/labels/geolocation-sensor or https://github.com/w3c/web-platform-tests/tree/master/geolocation-sensor yet. Maybe @kenchris can review it. I submitted a PR to clarify related concepts in w3c/sensors#348 |
@anssiko, we have the test at https://github.com/w3c/web-platform-tests/blob/master/generic-sensor/generic-sensor-tests.js#L76 But I have one concern, if the senor reading is the same with previous one(with same timestamp), |
Yes, the test above is from WPT :-) @Honry, if you do a new sensor, it might very well return an existing value and that will then of course trigger "reading" events or resolve read(). This might change when we add options to the new spec, like maxAge or similar |
@Honry good catch,
What would be a good default behavior for When we have an agreement on the above, need to figure out how to spec this preferably reusing the abstract operations from the Generic Sensor API. |
I would be fine with a cached reading... if it's within a reasonable timeframe, especially with this one-shot... This is mostly useful for rough estimates on the location of the user, like country/neighborhood. When we add options, people can specify a different "maxAge" or similar. But I think for default, 15-60 minutes might not be bad |
I am fine with it |
Closing in favor of #25. |
The following fails
As geolocation updates are slow and it will get the same reading with the same timestamp, making this test fail.
I guess either the test is wrong, or timestamp should be when the event fires
The text was updated successfully, but these errors were encountered: