-
Notifications
You must be signed in to change notification settings - Fork 153
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
Improve Geolocation package. #36
base: master
Are you sure you want to change the base?
Conversation
Add the ability to tweak the PositionOptions used for Geolocation, for instance to use low-accuracy position to save battery on mobile devices. The options parameter is reactive. Add a `pause` feature to temporarily halt position updates, again to allow better power management on mobile devices. The paused status is also reactive. Stop position watcher when there are no dependencies of the location, so that we automatically save power if (for example) a reactive map view is not visible.
10a0d36
to
2ca4428
Compare
Hey, sorry I'm behind on reviewing this. I'll try to get to it this week. |
@cscott: this is definitely something I've been looking for. going to try your branch out while waiting for this PR to land. 👍 |
### Geolocation.setOptions(options) | ||
|
||
Provide [PositionOptions](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions) to manage power consumption on mobile devices. The options can be reactive. |
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.
What does "The options can be reactive." mean in this context?
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.
See the simple-map example above. You can call:
var loc = Geolocation.latLng({ enableHighAccuracy: !!Session.get("highAccuracy") });
and the reactive-dependency magic will work to ensure that loc
is properly updated if the Session
variable changes (or if the location changes, naturally). The watcher that is created behind the scenes will be properly torn down/rebuilt iff it is necessary when this statement is recomputed.
|
This will need to be re-done and updated. Currently as is is not mergable, also because of CLA not signed. |
Add the ability to tweak the PositionOptions used for Geolocation, for
instance to use low-accuracy position to save battery on mobile devices.
The options parameter is reactive.
Add a
pause
feature to temporarily halt position updates, again toallow better power management on mobile devices. The paused status
is also reactive.
Stop position watcher when there are no dependencies of the location,
so that we automatically save power if (for example) a reactive map
view is not visible.