aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/locate.js
diff options
context:
space:
mode:
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');