If you're talking about the Geolocation API, you can override the function:
navigator.geolocation.getCurrentPosition = function(success, failure) {
success({ coords: {
latitude: 30,
longitude: -105,
}, timestamp: Date.now() });
}
So when a library calls into the navigator.geolocation.getCurrentPosition
function the coordinates you specify will be returned.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…