Skip to content

Add change event to Geolocation #1858

Merged
merged 2 commits into from Mar 17, 2014

3 participants

@elemoine
OpenLayers member

This PR makes Geolocation instances dispatch change events when the geolocation changes.

Currently the example in the API doc suggests listening to change:position to get notified when the geolocation changes. But speed and accuracy_geometry are not yet up-to-date when this event occurs. This PR fixes this problem by introducing a change event dispached when all the geolocation properties have been updated.

Please review.

@twpayne twpayne commented on the diff Mar 14, 2014
src/ol/geolocation.js
@@ -44,7 +44,7 @@ ol.GeolocationProperty = {
* // take the projection to use from the map's view
* geolocation.bindTo('projection', map.getView());
* // listen to changes in position
- * geolocation.on('change:position', function(evt) {
+ * geolocation.on('change', function(evt) {
* window.console.log(geolocation.getPosition());
@twpayne
twpayne added a note Mar 14, 2014

This debugging code should probably be removed (I know that it was already present).

@elemoine
OpenLayers member
elemoine added a note Mar 14, 2014

Yep, I'll remove it.

@elemoine
OpenLayers member
elemoine added a note Mar 14, 2014

This console.log is actually in the API doc :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fredj
OpenLayers member
fredj commented Mar 14, 2014

+1

@elemoine elemoine merged commit f019f3e into openlayers:master Mar 17, 2014

1 check passed

Details default The Travis CI build passed
@elemoine elemoine deleted the elemoine:geolocation branch Mar 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.