Make geolocation errors less annoying

master
Skylar Ittner 5 years ago
parent 23e9ed09ba
commit 88f6f54aab

@ -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: '<i class="fas fa-compass"></i> ' + error,
position: "bottom",
destroyOnClose: true,
closeTimeout: 5000
closeTimeout: 1000 * 4
});
});

Loading…
Cancel
Save