Created
November 5, 2013 14:36
-
-
Save jrmlstf/7319931 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
console.log('geoloc start'); | |
var geolocStart = +new Date(); | |
navigator.geolocation.getCurrentPosition( | |
function (position) { | |
console.log('geoloc end'); | |
var min = 5000, | |
start = geolocStart, | |
end = position.timestamp, | |
elapsed = end - start; | |
if (elapsed < min) { | |
console.log('too quick'); | |
var delay = min - elapsed; | |
setTimeout(function () { | |
console.log(delay); | |
}, delay); | |
} | |
}, | |
function () { | |
console.log('error'); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment