{"_id":"mock-geolocation","_rev":"28-082f59326571f198da955bbaa4a9b754","name":"mock-geolocation","dist-tags":{"latest":"1.0.11"},"versions":{"1.0.9":{"name":"mock-geolocation","version":"1.0.9","keywords":["geolocation","mock"],"author":{"name":"Mstislav Zhivodkov","email":"stevemyz@gmail.com"},"license":"MIT","_id":"mock-geolocation@1.0.9","maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"homepage":"https://github.com/2gis/mock-geolocation","bugs":{"url":"https://github.com/2gis/mock-geolocation/issues"},"dist":{"shasum":"b1bf32950296924ec06b497863d808e1c12aa7ba","tarball":"https://registry.npmjs.org/mock-geolocation/-/mock-geolocation-1.0.9.tgz","integrity":"sha512-MvX8i2xKADElav/YYznCKK4aw9bEMXfsYXOUTBNIKzUAo8TvqzwmdUT99VIVUTZUt1OhqIGw5K8Qlm/He1wQJA==","signatures":[{"sig":"MEUCIQC/EX4WtcGuyuIcmpd3XYlCnoUy9XL8Y8CYZS59I6A4tQIgO8HEU8/whCkelLe4bsdIAQXFVz/DKdDxfZ4fDIUl7u4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"b1bf32950296924ec06b497863d808e1c12aa7ba","gitHead":"a6b2a3d30f8702e1e7c92fe307d35ac7a60910ca","scripts":{},"_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"repository":{"url":"https://github.com/2gis/mock-geolocation.git","type":"git"},"_npmVersion":"2.1.10","description":"Mock for navigator.geolocation API","directories":{},"_nodeVersion":"0.10.25","dependencies":{},"devDependencies":{"gulp":"^3.8.11","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0"}},"1.0.10":{"name":"mock-geolocation","version":"1.0.10","keywords":["geolocation","mock"],"author":{"name":"Mstislav Zhivodkov","email":"stevemyz@gmail.com"},"license":"MIT","_id":"mock-geolocation@1.0.10","maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"homepage":"https://github.com/2gis/mock-geolocation","bugs":{"url":"https://github.com/2gis/mock-geolocation/issues"},"dist":{"shasum":"8c81e3c91b3a559c02108c2e85a843d688d7a95a","tarball":"https://registry.npmjs.org/mock-geolocation/-/mock-geolocation-1.0.10.tgz","integrity":"sha512-yEuqYaXbnKADkkB+1QlwqIljVXrev2OKVumTFvfZxuDbsUPPBjvOxKuPxuE4KVMSCgxgi6J2rRzfCpGCFBrT3w==","signatures":[{"sig":"MEUCIC5AbMVwNOgeELMw5vOMb9bhT2GO/bKsz1cWevG2Ysz/AiEA5Pqf2BA3J/mc34otI7qOGeyEW6O8xsJgZjJ1nE6UlQs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"8c81e3c91b3a559c02108c2e85a843d688d7a95a","gitHead":"1f72294920ca7a370c63a5486b304b39d3f67f71","scripts":{},"_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"repository":{"url":"https://github.com/2gis/mock-geolocation.git","type":"git"},"_npmVersion":"2.1.10","description":"Mock for navigator.geolocation API","directories":{},"_nodeVersion":"0.10.25","dependencies":{},"devDependencies":{"gulp":"^3.8.11","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0"}},"1.0.11":{"name":"mock-geolocation","version":"1.0.11","keywords":["geolocation","mock"],"author":{"name":"Mstislav Zhivodkov","email":"stevemyz@gmail.com"},"license":"MIT","_id":"mock-geolocation@1.0.11","maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"homepage":"https://github.com/2gis/mock-geolocation","bugs":{"url":"https://github.com/2gis/mock-geolocation/issues"},"dist":{"shasum":"2c7b99242a2c70dbecd317b392b30311722992c8","tarball":"https://registry.npmjs.org/mock-geolocation/-/mock-geolocation-1.0.11.tgz","integrity":"sha512-F/kvZfwuVnuPNHjHPuSVZlch8HnLwZgq7LVyp83PKSW3sXYm3tJhi/Z1gIHvnbY953YfAxiq5a7wFhgzX+qIkg==","signatures":[{"sig":"MEQCIDb/AugDNz4FDYynr6J2eHuVFuCWyT3+O1zBAaiCg1DnAiBe65TD7t7GnwLkWgA53WTAoYYEP6t+SKswgoVNweRlNQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"2c7b99242a2c70dbecd317b392b30311722992c8","gitHead":"20b9a3d908a3ab3aaef8e247dfe176e0953ff85d","scripts":{},"_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"repository":{"url":"https://github.com/2gis/mock-geolocation.git","type":"git"},"_npmVersion":"1.4.28","description":"Mock for navigator.geolocation API","directories":{},"dependencies":{},"devDependencies":{"gulp":"^3.8.11","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0"}}},"time":{"created":"2015-03-13T08:37:23.097Z","modified":"2026-09-07T09:52:05.192Z","1.0.9":"2015-03-13T08:37:23.097Z","1.0.10":"2015-03-16T04:34:54.996Z","1.0.11":"2015-09-01T08:29:01.765Z"},"bugs":{"url":"https://github.com/2gis/mock-geolocation/issues"},"author":{"name":"Mstislav Zhivodkov","email":"stevemyz@gmail.com"},"license":"MIT","homepage":"https://github.com/2gis/mock-geolocation","keywords":["geolocation","mock"],"repository":{"url":"https://github.com/2gis/mock-geolocation.git","type":"git"},"description":"Mock for navigator.geolocation API","maintainers":[{"email":"stevemyz@gmail.com","name":"trufi"},{"email":"artem.malko@gmail.com","name":"artem.malko"},{"email":"mbeloshitsky@gmail.com","name":"itanka9"},{"email":"a.artemev@inbox.ru","name":"alxart"},{"email":"vitaliy.gis@gmail.com","name":"vitaliy.gis"},{"email":"mail@kuznetsov.it","name":"kuznetcoff"},{"email":"v.ayrikh@2gis.ru","name":"vladimir-ayrikh"},{"email":"oleg1556@gmail.com","name":"kalyanov"},{"email":"excorester@gmail.com","name":"playreal"},{"email":"terabite@inbox.ru","name":"spuneo"}],"readme":"# Mock-geolocation\nMock for ```navigator.geolocation```.\n\n### [Russian readme](https://github.com/2gis/mock-geolocation/blob/master/README_RU.md) ###\n\n### [Demo](http://2gis.github.io/mock-geolocation/) ###\n\n```javascript\nvar point = [54.980206086231, 82.898068362003];\n\ngeolocate.use();\n\nnavigator.geolocation.getCurrentPosition(function(position) {\n  assert(position.coords.latitude).equal(point[0]);\n  assert(position.coords.longitude).equal(point[1]);\n});\n\ngeolocate.send({lat: point[0], lng: point[1]});\n\ngeolocate.restore();\n```\n## Installation\nManually:\n```html\n<script src=\"geolocate.js\"></script>\n```\nFrom ```npm```:\n```\nnpm install mock-geolocation\n```\nAs ```CommonJS``` or ```AMD``` module:\n```javascript\nvar geolocate = require('mock-geolocation');\n```\n## API\n### .use()\nReplace the native ```navigator.geolocation``` object\n### .restore()\nRestore ```navigator.geolocation``` in original state\n### .send([options])\nThis method emulates the finding position after calling [getCurrentPosition](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation.getCurrentPosition) and [watchPosition](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation.watchPosition) method.\nUpdates position from ```options``` which may include the following parameters from [positions.coords](https://developer.mozilla.org/en-US/docs/Web/API/Coordinates) and [timestamp](https://developer.mozilla.org/en-US/docs/Web/API/Position.timestamp).\n```javascript\nnavigator.geolocation.getCurrentPosition(function(position) {\n  console.log(position);\n});\n\ngeolocate.send({\n  latitude: 50,\n  longitude: 10,\n  accuracy: 5,\n  timestamp: 3000\n});\n\n/* {\n  coords: {\n    accuracy: 5,\n    altitude: null\n    altitudeAccuracy: null,\n    heading: null,\n    latitude: 50\n    longitude: 10,\n    speed: null\n  },\n  timestamp: 3000\n} */\n\nnavigator.geolocation.getCurrentPosition(function(position) {\n  console.log(position);\n});\n\ngeolocate.send();\n\n/* Show same position {\n  coords: {\n    accuracy: 5,\n    altitude: null\n    altitudeAccuracy: null,\n    heading: null,\n    latitude: 50\n    longitude: 10,\n    speed: null\n  },\n  timestamp: 3000\n} */\n```\n### .change(options)\nChange current position and call ```success callback``` of ```watchPosition``` method.\nUpdates position from ```options``` which may include the following parameters from [positions.coords](https://developer.mozilla.org/en-US/docs/Web/API/Coordinates) and [timestamp](https://developer.mozilla.org/en-US/docs/Web/API/Position.timestamp).\n```javascript\nnavigator.geolocation.watchPosition(function(position) {\n  console.log(position.coords.latitude + ', ' + position.coords.longitude);\n});\n\ngeolocate.send();\n// 54.9799, 82.89683699999999\n\ngeolocate.change({lat: 10, lng: 15});\n// 10, 15\n\ngeolocate.change({lat: 25});\n// 25, 15\n```\n### .sendError([options])\nCall ```error callback``` of ```getCurrentPosition``` method.\n```options``` may include the parameters [code and message](https://developer.mozilla.org/en-US/docs/Web/API/PositionError).\n### .changeError([options])\nCall ```error callback``` of ```watchPosition``` method.\n```options``` may include the parameters [code and message](https://developer.mozilla.org/en-US/docs/Web/API/PositionError).\n","readmeFilename":"README.md"}