{"_id":"geolocate.js","_rev":"41-bd9dc74cc1fc9da0dfdc253eb93438fa","name":"geolocate.js","description":"Mock for navigator.geolocation","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.0":{"name":"geolocate.js","version":"1.0.0","author":{"name":"Trufi","email":"stevemyz@gmail.com"},"keywords":["geolocation"],"scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"dependencies":{},"devDependencies":{"gulp":"~3.8.8","gulp-uglify":"~1.0.1","gulp-rename":"~1.2.0"},"description":"Мок для ```navigator.geolocation```. Модуль подменяет стандартную геолокацию браузера. ```javascript var point = [54.980206086231, 82.898068362003];","bugs":{"url":"https://github.com/2gis/geolocate/issues"},"_id":"geolocate.js@1.0.0","dist":{"shasum":"6f81d6d9b40904b6d1c50385805c8c232208aff7","tarball":"https://registry.npmjs.org/geolocate.js/-/geolocate.js-1.0.0.tgz","integrity":"sha512-7P3gJbQgqpiAsjze1T65X82osUUy5hh1rswPveZRAnGLRA5xSn2D0OdwA+DdHL49uRvpg6/PviQEglh0uGFnGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICPBICm4BpBlAqENNkm2J3bTnP6SqtX7G8hsX8xKeVgRAiBFE1DU/Sw2+zaIVl9PvxC9xQDyx399E55h8sD6w0IFWA=="}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"deprecated":"Project renamed to mock-geolocation"},"1.0.1":{"name":"geolocate.js","version":"1.0.1","author":{"name":"Trufi","email":"stevemyz@gmail.com"},"keywords":["geolocation"],"scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"dependencies":{},"devDependencies":{"gulp":"~3.8.8","gulp-uglify":"~1.0.1","gulp-rename":"~1.2.0"},"description":"Mock for navigator.geolocation","bugs":{"url":"https://github.com/2gis/geolocate/issues"},"_id":"geolocate.js@1.0.1","dist":{"shasum":"07be6b56831fc110f6b0fe49e5fd59a4f2b97ac4","tarball":"https://registry.npmjs.org/geolocate.js/-/geolocate.js-1.0.1.tgz","integrity":"sha512-T6fdhFZVskL5TwPO3QnvvR3CE5JabWZpDf9XaHajtUrblUXqEcJsrd7XVcWYaowIma3OGpk4GX82YAfqQ0N73w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBIzHbIHEglYnqvySMEPEE7VNTrG031p7EqJpF21OKtMAiEA3zgyPlajNTynj+eCygHMpQb0hugZW3vfg3E5rw4NZg4="}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"deprecated":"Project renamed to mock-geolocation"},"1.0.2":{"name":"geolocate.js","version":"1.0.2","author":{"name":"Trufi","email":"stevemyz@gmail.com"},"keywords":["geolocation"],"scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"dependencies":{},"devDependencies":{"gulp":"~3.8.8","gulp-uglify":"~1.0.1","gulp-rename":"~1.2.0"},"description":"Mock for navigator.geolocation","bugs":{"url":"https://github.com/2gis/geolocate/issues"},"_id":"geolocate.js@1.0.2","dist":{"shasum":"5371a6f60b712c2189ca1f0434831a7a27d1dd98","tarball":"https://registry.npmjs.org/geolocate.js/-/geolocate.js-1.0.2.tgz","integrity":"sha512-ZltnbcH3NMe99fTSHqf3am1ei/fQYMVc0Zrn0s6JFTlqhs+RpCnFZcIjpbmx3sTyLintn8Ff11kKiI8Eav3bMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCFtxdBp0IsQ7t7RUpurBwpC6VTJxFki9q8z5LlpsI8DgIhAMhSu46sI+nDuEVf365NEDqW8ha3Jn6OkLX+0oh7b7d6"}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"deprecated":"Project renamed to mock-geolocation"},"1.0.3":{"name":"geolocate.js","version":"1.0.3","author":{"name":"Trufi","email":"stevemyz@gmail.com"},"keywords":["geolocation"],"scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"dependencies":{},"devDependencies":{"gulp":"~3.8.8","gulp-uglify":"~1.0.1","gulp-rename":"~1.2.0"},"description":"Mock for ```navigator.geolocation```.","bugs":{"url":"https://github.com/2gis/geolocate/issues"},"_id":"geolocate.js@1.0.3","dist":{"shasum":"dcd890723059ef74e7ed768e8c9123edf8475cf6","tarball":"https://registry.npmjs.org/geolocate.js/-/geolocate.js-1.0.3.tgz","integrity":"sha512-kdaa7yAaxOb1w7P1k+HTWlQ0GP/XqxIugfF674Nio1+zoeCijaQMsI2TwdwRW4PolGrPtZitKLaRhA4XrUZByA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzAIfLI1WcyUsP1a8bsG+ixZ1mrbSVXzaLC2IP2hWaKAIhAIa6DmKAzk7djyVlj92p/UeFu8NHfiO0hq1ljz/dISIL"}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"deprecated":"Project renamed to mock-geolocation"},"1.0.4":{"name":"geolocate.js","version":"1.0.4","author":{"name":"Trufi","email":"stevemyz@gmail.com"},"keywords":["geolocation"],"scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"dependencies":{},"devDependencies":{"gulp":"~3.8.8","gulp-uglify":"~1.0.1","gulp-rename":"~1.2.0"},"description":"Mock for ```navigator.geolocation```.","bugs":{"url":"https://github.com/2gis/geolocate/issues"},"_id":"geolocate.js@1.0.4","dist":{"shasum":"b0061986c880a15a29f6be71dd5d7045565263be","tarball":"https://registry.npmjs.org/geolocate.js/-/geolocate.js-1.0.4.tgz","integrity":"sha512-U8I34iyklTUZHvU+vk6gtKI0qyfJx6lgwONsUxXnq32W/80fb3MvwFiLrlkE/B3lAcdBz8ycWwYsw+ea6m0NrQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCs+fXwJboriE1+hY1zjayn4L16U6RCJaUru5wPLnz0BQIhAJtYm8iWCSbW2GdP42eJcqkqCyuxVaLxV45mBtZraBCI"}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"deprecated":"Project renamed to mock-geolocation"},"1.0.5":{"name":"geolocate.js","version":"1.0.5","author":{"name":"Trufi","email":"stevemyz@gmail.com"},"keywords":["geolocation"],"scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"dependencies":{},"devDependencies":{"gulp":"~3.8.8","gulp-uglify":"~1.0.1","gulp-rename":"~1.2.0"},"description":"Mock for ```navigator.geolocation```.","bugs":{"url":"https://github.com/2gis/geolocate/issues"},"_id":"geolocate.js@1.0.5","dist":{"shasum":"0f95691425d9721273d98e130d015f441efb5c2e","tarball":"https://registry.npmjs.org/geolocate.js/-/geolocate.js-1.0.5.tgz","integrity":"sha512-kgOKRwRXHiOq7gHiGW0R/bJJ5Hpzd3mHna9ydZ4qgYyNIdloEHVYaTOuf1HtdGbfBa7cuIb6yc8mA1Xu2e39aw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvRGNWhLlcrFabgcCbXHP1Kc97y1FYLZYQUsMxBaMS7QIgdIq2LknWig9XmmVb/a42n2opIO2K+YOBGI+eRvwPohA="}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"deprecated":"Project renamed to mock-geolocation"},"1.0.6":{"name":"geolocate.js","version":"1.0.6","author":{"name":"Trufi","email":"stevemyz@gmail.com"},"keywords":["geolocation"],"scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"dependencies":{},"devDependencies":{"gulp":"~3.8.8","gulp-uglify":"~1.0.1","gulp-rename":"~1.2.0"},"description":"Mock for ```navigator.geolocation```.","bugs":{"url":"https://github.com/2gis/geolocate/issues"},"_id":"geolocate.js@1.0.6","dist":{"shasum":"68432fdccf9f1c79864af9b375e18e77f1f87435","tarball":"https://registry.npmjs.org/geolocate.js/-/geolocate.js-1.0.6.tgz","integrity":"sha512-v/f52vn/NCV9aahjYTHSmNka/241RKELv6UH40Ckxn2W8opBXcSMhnPCGpjdTmctG+3peePNMJgfZX5OABmx9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXe9QMvcYmVoaqp6KKneZbMXo9JVQnU5pe1HX2IS1PwwIgCoE36zD8djWJFphvdKoDGcA5UTKPaipfeZmzR/iT17I="}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"deprecated":"Project renamed to mock-geolocation"},"1.0.7":{"name":"geolocate.js","version":"1.0.7","description":"Mock for navigator.geolocation","author":{"name":"Trufi","email":"stevemyz@gmail.com"},"keywords":["geolocation"],"scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"dependencies":{},"devDependencies":{"gulp":"~3.8.8","gulp-uglify":"~1.0.1","gulp-rename":"~1.2.0"},"bugs":{"url":"https://github.com/2gis/geolocate/issues"},"_id":"geolocate.js@1.0.7","dist":{"shasum":"e2e862f177902d8026c54c428237a738200ee97c","tarball":"https://registry.npmjs.org/geolocate.js/-/geolocate.js-1.0.7.tgz","integrity":"sha512-fG4LuVHovXcmMPeTELAsz9TCTSMRxs0xvWcTnKkdfVLDrdF3ZDS2rW4+Ttx5lOTjCMFNstDPROAypal+XshuzA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIChNzqVA5tj5CpjyRSbpCMPr6ZSbCsahh1C1ZjmYOuE+AiEAsBMvxq8InNyZjSj2JNentei6XEi9PptDo4RA6Cxo9Ag="}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"deprecated":"Project renamed to mock-geolocation"},"1.0.8":{"name":"geolocate.js","version":"1.0.8","description":"Mock for navigator.geolocation","author":{"name":"Trufi","email":"stevemyz@gmail.com"},"license":"MIT","keywords":["geolocation"],"scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"dependencies":{},"devDependencies":{"gulp":"~3.8.8","gulp-uglify":"~1.0.1","gulp-rename":"~1.2.0"},"bugs":{"url":"https://github.com/2gis/geolocate/issues"},"_id":"geolocate.js@1.0.8","dist":{"shasum":"0d1a4f45915aafe0fc55a3c8878b2a113f158dfc","tarball":"https://registry.npmjs.org/geolocate.js/-/geolocate.js-1.0.8.tgz","integrity":"sha512-gm27lk2jvEsYbSgooxIuS8TJmma+IBINj045pKm7JLdLmuCC0Dm8xLzeJTENqJvCfZxw8r4F9CLZ0QFpmwp21w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGEdzM1q45wxHv3mSsjv0ORdqcG9xVZ2cYMs8Bx+f3nNAiBtNBlkEVETL0oblcxj9+imf+Y38mSW4U0taOJSOjNIAQ=="}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"trufi","email":"stevemyz@gmail.com"},"maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"deprecated":"Project renamed to mock-geolocation"}},"readme":"#Geolocate\nMock for ```navigator.geolocation```.\n\n###[Russian readme](https://github.com/2gis/geolocate/blob/master/README_RU.md)###\n\n###[Demo](http://2gis.github.io/geolocate/)###\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 geolocate.js\n```\nAs ```CommonJS``` or ```AMD``` module:\n```javascript\nvar geolocate = require('geolocate.js');\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","maintainers":[{"name":"trufi","email":"stevemyz@gmail.com"}],"time":{"modified":"2022-06-18T07:39:05.305Z","created":"2014-10-29T09:11:05.123Z","1.0.0":"2014-10-29T09:11:08.500Z","1.0.1":"2014-10-29T09:25:46.132Z","1.0.2":"2014-10-29T09:31:06.465Z","1.0.3":"2014-10-29T09:36:46.704Z","1.0.4":"2014-10-29T09:46:23.894Z","1.0.5":"2014-10-29T09:50:33.836Z","1.0.6":"2014-10-31T10:40:37.728Z","1.0.7":"2014-10-31T10:45:06.889Z","1.0.8":"2014-10-31T11:07:49.471Z"},"readmeFilename":"README.md","keywords":["geolocation"],"repository":{"type":"git","url":"https://github.com/2gis/geolocate.git"},"author":{"name":"Trufi","email":"stevemyz@gmail.com"},"bugs":{"url":"https://github.com/2gis/geolocate/issues"},"license":"MIT"}