Mock-geolocation
Mock for navigator.geolocation
.
Russian readme
Demo
var point = 54980206086231 82898068362003; geolocate; navigatorgeolocation; geolocate; geolocate;
Installation
Manually:
From npm
:
npm install mock-geolocation
As CommonJS
or AMD
module:
var geolocate = ;
API
.use()
Replace the native navigator.geolocation
object
.restore()
Restore navigator.geolocation
in original state
.send([options])
This method emulates the finding position after calling getCurrentPosition and watchPosition method.
Updates position from options
which may include the following parameters from positions.coords and timestamp.
navigatorgeolocation; geolocate; /* { coords: { accuracy: 5, altitude: null altitudeAccuracy: null, heading: null, latitude: 50 longitude: 10, speed: null }, timestamp: 3000} */ navigatorgeolocation; geolocate; /* Show same position { coords: { accuracy: 5, altitude: null altitudeAccuracy: null, heading: null, latitude: 50 longitude: 10, speed: null }, timestamp: 3000} */
.change(options)
Change current position and call success callback
of watchPosition
method.
Updates position from options
which may include the following parameters from positions.coords and timestamp.
navigatorgeolocation; geolocate;// 54.9799, 82.89683699999999 geolocate;// 10, 15 geolocate;// 25, 15
.sendError([options])
Call error callback
of getCurrentPosition
method.
options
may include the parameters code and message.
.changeError([options])
Call error callback
of watchPosition
method.
options
may include the parameters code and message.