Created
July 10, 2019 12:11
-
-
Save mittsh/fe1aff91354c7f21bd59b99cc51088ee to your computer and use it in GitHub Desktop.
Simulate a fake location in browser API
This file contains hidden or 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
navigator.geolocation.getCurrentPosition = (fn) => { | |
setTimeout(() => { | |
fn({ | |
coords: { | |
accuracy: 40, | |
altitude: null, | |
altitudeAccuracy: null, | |
heading: null, | |
latitude: 13.705848, | |
longitude: 100.622798, | |
speed: null, | |
}, | |
timestamp: Date.now(), | |
}) | |
}, 2912) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks man! setTimeout is what makes this thing consistent