Skip to content

Instantly share code, notes, and snippets.

@jrmlstf
Created November 5, 2013 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrmlstf/7319931 to your computer and use it in GitHub Desktop.
Save jrmlstf/7319931 to your computer and use it in GitHub Desktop.
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