Created
March 23, 2016 09:04
-
-
Save Artistan/c33d8b29172c38cded70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var location_timeout = setTimeout(function () { | |
navigator.geolocation.clearWatch(WatchID); | |
self.findLocationByIP(callback); | |
}, 15000); | |
var WatchID = navigator.geolocation.watchPosition( | |
function (position) { // Success callback | |
clearTimeout(location_timeout); | |
self.setFoundUserLocation(position.coords.latitude, position.coords.longitude, callback); | |
}, | |
function () { // Error callback | |
clearTimeout(location_timeout); | |
self.findLocationByIP(callback); | |
}, | |
{maximumAge: 100000, timeout: 12000, enableHighAccuracy: true} // Options | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment