aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/locate.js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-03-20 12:07:03 +0000
committerStruan Donald <struan@exo.org.uk>2013-03-20 12:07:03 +0000
commit9eeab52898bda47f0b412d0e6880936a64de0726 (patch)
tree28d5be4c295b4bf933a65642fcce504d2dea8436 /www/js/locate.js
parent41ab04a13cb83f7e1e79fd5ed23989720fa0ee60 (diff)
display blue dot at current location and update as person moves
Diffstat (limited to 'www/js/locate.js')
-rw-r--r--www/js/locate.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/www/js/locate.js b/www/js/locate.js
index 25853be..7d4c713 100644
--- a/www/js/locate.js
+++ b/www/js/locate.js
@@ -70,6 +70,26 @@
);
},
+ updatePosition: function() {
+ console.log('updatePosition');
+ var that = this;
+ this.update_watch_id = navigator.geolocation.watchPosition(
+ function(location) {
+ if ( that.update_watch_id === undefined ) { console.log( 'no update watch id' ); return; }
+
+ that.trigger('gps_current_position', { coordinates: location.coords } );
+ },
+ function() {},
+ { timeout: 20000, enableHighAccuracy: true }
+ );
+ },
+
+ stopUpdating: function() {
+ if ( this.update_watch_id ) {
+ navigator.geolocation.clearupdate_watch( this.watch_id );
+ delete this.update_watch_id;
+ }
+ },
check_location: function(coords) {
console.log('check_location');