diff --git a/www/js/map.js b/www/js/map.js index a3e0ade..5709de0 100644 --- a/www/js/map.js +++ b/www/js/map.js @@ -61,7 +61,9 @@ function mapEasing(t) { return t * (2 - t); } -gotfirstfix = false; +var gotfirstfix = false; + +var geoerrorcount = 0; watchLocation(function (position) { if (gotfirstfix) { @@ -72,11 +74,17 @@ watchLocation(function (position) { gotfirstfix = true; } }, function (error) { + geoerrorcount++; + console.log("Geolocation error #" + geoerrorcount + ": ", error); + // Stop showing error toasts if they're happening a lot + if (geoerrorcount > 3) { + return; + } app.toast.show({ text: ' ' + error, position: "bottom", destroyOnClose: true, - closeTimeout: 5000 + closeTimeout: 1000 * 4 }); });