{"_id":"@awesome-cordova-library/geolocation","_rev":"1-2c72076e18a406935bc701a4135e7435","name":"@awesome-cordova-library/geolocation","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@awesome-cordova-library/geolocation","version":"1.0.0","description":"This plugin provides information about the device's location, such as latitude and longitude.","main":"lib/index.js","types":"lib/index.d.ts","keywords":["cordova","capacitor","ionic","javascript","mobile","geolocation","location","reactjs"],"publishConfig":{"access":"public"},"author":{"name":"Jordan AZOULAY","email":"jazoulay@joazco.com","url":"https://github.com/joazco"},"license":"SEE LICENSE IN LICENSE","repository":{"type":"git","url":"git://github.com/joazco/awesome-cordova-library.git"},"bugs":{"url":"https://github.com/joazco/awesome-cordova-library/issues"},"homepage":"https://github.com/joazco/awesome-cordova-library","devDependencies":{"@types/jest":"^27.5.1","@types/react":"~17.0.21","jest":"^28.1.0","prettier":"^2.6.2","ts-jest":"^28.0.3","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","typescript":"^4.7.2"},"scripts":{"build":"rm -rf lib/ && tsc","build-yalc":"npm run build; yalc publish --push --private","test":"jest --config jestconfig.json","format":"prettier --write \"src/**/*.ts\"","lint":"tslint -p tsconfig.json","prepublish":"npm run format; npm run lint; npm test; npm run build"},"directories":{"lib":"lib"},"dependencies":{},"gitHead":"e05ff944cc07d533f75dd2fc6fd6e74bb07d5c0e","_id":"@awesome-cordova-library/geolocation@1.0.0","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-cbqgekQL41awmN2AkHZLbRkUwziGyj5Kf60WmZWAxoJXhfcnlNSfhqpEDptZI58WtsAQuc6lLI+uDI21IVkQNw==","shasum":"217128cde235db09c6b67921a7ce9947d928f063","tarball":"https://registry.npmjs.org/@awesome-cordova-library/geolocation/-/geolocation-1.0.0.tgz","fileCount":7,"unpackedSize":8723,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDv6PzgI9rlGL6WHZGxzpOY21slpgJzJpntEOZEVJ5xkAiEA5rV68U10GDx54T2gKW/gQB8CN3vpiXVW5QY+LNweKRY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjV6KFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqiA//a/M5nnlbvtgAlITZ35Od2ojBdjo65JcfovL415paI09/rl1G\r\nnkOqVvB95+oMQWy6aR3kP8T3Nvu/UXGT8IC4EO8XCf79C5s+dJy5grPiveoI\r\nM1h1ibNUpUb3b9xBEVqPrscrTiMinytGScQRbm5zBYCOrUqfIPxBTtTb6e7U\r\nW7dvmFnlhkgYX9er6ehElYL5wSappHnqsNdqFOnuGlbs6gEQX2DhJ3HKGUHt\r\nSw2vrvXA8i64stZ9DXt2r6rBy9QD6emXMMSQLR/bMTbjVFXGqdRNIXmpYTdn\r\n0RVzjizD706In043LQ4unx/jiVHjPTCzJVn6Z3uM/t0yLNNac5W6xit8idxJ\r\njlEq6yDh8/IRKjUsiIV3kD8KGQ7FH6kfA0ghhGum3Q3l8YXtpcHe7ddF1rOc\r\nrqUb7xRQBzmbWq2KxTANb66sB473quzRtRuhHbLFmMjKUfTwDj+aWO3RLHG7\r\nJR8cqpvixQqZm1qDxpeOCv4zs/7M65WfySAk+AasHlexiQ7prlZrF1jZlUXB\r\nW80JZ/ibg0SUdG0OpDXYjDaaZVQxdHk4lWv8jRATHUsJtFeQtsAM/MH5YVwn\r\npIDRML6zrTnh2YDd1cWytrHn0cvJr+VAr9xgDlMWdLwNDDWS0dYZ88uJWGqZ\r\npf7+iotTdVifO8xYOC+N/GHTWC0KUK/aZWA=\r\n=ZPlD\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"joazco","email":"jazoulay@joazco.com"},"maintainers":[{"name":"joazco","email":"jazoulay@joazco.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/geolocation_1.0.0_1666687621373_0.3846847052513438"},"_hasShrinkwrap":false},"1.0.1":{"name":"@awesome-cordova-library/geolocation","version":"1.0.1","description":"This plugin provides information about the device's location, such as latitude and longitude.","main":"lib/index.js","types":"lib/index.d.ts","keywords":["cordova","capacitor","ionic","javascript","mobile","geolocation","location","reactjs"],"publishConfig":{"access":"public"},"author":{"name":"Jordan AZOULAY","email":"jazoulay@joazco.com","url":"https://github.com/joazco"},"license":"SEE LICENSE IN LICENSE","repository":{"type":"git","url":"git://github.com/joazco/awesome-cordova-library.git"},"bugs":{"url":"https://github.com/joazco/awesome-cordova-library/issues"},"homepage":"https://github.com/joazco/awesome-cordova-library","devDependencies":{"@types/jest":"^27.5.1","@types/react":"~17.0.21","jest":"^28.1.0","prettier":"^2.6.2","ts-jest":"^28.0.3","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","typescript":"^4.7.2"},"scripts":{"build":"rm -rf lib/ && tsc","build-yalc":"npm run build; yalc publish --push --private","test":"jest --config jestconfig.json","format":"prettier --write \"src/**/*.ts\"","lint":"tslint -p tsconfig.json","prepublish":"npm run format; npm run lint; npm test; npm run build"},"directories":{"lib":"lib"},"dependencies":{},"gitHead":"2a2b9cf007a870056251632315547e6a651d26a0","_id":"@awesome-cordova-library/geolocation@1.0.1","_nodeVersion":"16.20.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-Kl+/OvnvkS6XGBF3V5HoHVLOu/8MRU0FoG+gZJ3uxMa5W5tgWhktRpsqFDgGDKtUUyunZcFUshelGww5QRb9bg==","shasum":"075d904087d239c4593d71af8261a62333ed3181","tarball":"https://registry.npmjs.org/@awesome-cordova-library/geolocation/-/geolocation-1.0.1.tgz","fileCount":7,"unpackedSize":9136,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDX07dnE2nFOZEHlStvGs1BGikx2ICABAPpgtEkxJ13OgIhANhOB6s5Qc2Lu5o6UHPu9LJ/VKXu9PGnUcjIahyoqtMy"}]},"_npmUser":{"name":"joazco","email":"jazoulay@joazco.com"},"maintainers":[{"name":"joazco","email":"jazoulay@joazco.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/geolocation_1.0.1_1694498623562_0.7314845599701969"},"_hasShrinkwrap":false}},"time":{"created":"2022-10-25T08:47:01.294Z","1.0.0":"2022-10-25T08:47:01.519Z","modified":"2023-09-12T06:03:44.093Z","1.0.1":"2023-09-12T06:03:43.879Z"},"maintainers":[{"name":"joazco","email":"jazoulay@joazco.com"}],"description":"This plugin provides information about the device's location, such as latitude and longitude.","homepage":"https://github.com/joazco/awesome-cordova-library","keywords":["cordova","capacitor","ionic","javascript","mobile","geolocation","location","reactjs"],"repository":{"type":"git","url":"git://github.com/joazco/awesome-cordova-library.git"},"author":{"name":"Jordan AZOULAY","email":"jazoulay@joazco.com","url":"https://github.com/joazco"},"bugs":{"url":"https://github.com/joazco/awesome-cordova-library/issues"},"license":"SEE LICENSE IN LICENSE","readme":"---\nid: plugin-geolocation\ntitle: Geolocation\ntags:\n  - cordova\n  - capacitor\n  - ionic\n  - javascript\n  - typescript\n  - plugin\n  - mobile\n  - geolocation\n---\n\n# Geolocation\n\nThis plugin provides information about the device's location, such as latitude and longitude.\n\n[Online documentation](https://awesomecordovalibrary.com)\n\n[Cordova documentation](https://cordova.apache.org/docs/en/11.x/reference/cordova-plugin-geolocation/index.html)\n\n[MDN](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API)\n\n## Installation\n\n### Typescript/JS\n\n```sh\nnpm install @awesome-cordova-library/geolocation\n```\n\n### Cordova\n\n```sh\ncordova plugin add cordova-plugin-geolocation\nnpm install @awesome-cordova-library/geolocation\n```\n\n### Capacitor / Ionic\n\n```bash\nnpm install cordova-plugin-geolocation\nnpm install @awesome-cordova-library/geolocation\nnpx cap sync\n```\n\n## Vanilla\n\n### Declaration\n\n```typescript\nclass Geolocation {\n  static getCurrentPosition(\n    successCallback: PositionCallback,\n    errorCallback?: PositionErrorCallback | null,\n    options?: PositionOptions\n  ): void;\n  static watchPosition(\n    successCallback: PositionCallback,\n    errorCallback?: PositionErrorCallback | null,\n    options?: PositionOptions\n  ): number;\n  static clearWatch(watchId: number): void;\n}\n```\n\n### Usages\n\n```typescript\nimport Geolocation from \"@awesome-cordova-library/geolocation\";\n\nGeolocation.getCurrentPosition(\n  () => {},\n  () => {},\n  {}\n);\nconst watchid = Geolocation.watchPosition(\n  () => {},\n  () => {},\n  {}\n);\nGeolocation.clearWatch(watchid);\n```\n\n## React\n\n### Declaration\n\n```typescript\nconst useGeolocation: () => {\n  getCurrentPosition: (\n    options?: PositionOptions\n  ) => Promise<GeolocationPosition>;\n  watchPosition: (\n    successCallback: PositionCallback,\n    errorCallback?: PositionErrorCallback | null,\n    options?: PositionOptions\n  ) => number;\n  clearWatch: (watchId: number) => void;\n};\n```\n\n### Usages\n\n```typescript\nimport { useState } from \"react\";\nimport useGeolocation from \"@awesome-cordova-library/geolocation/lib/react\";\n\nfunction App() {\n  const [loading, setLoading] = useState<boolean>(false);\n  const [position, setPosition] = useState<GeolocationPosition | undefined>();\n  const { getCurrentPosition } = useGeolocation();\n\n  return (\n    <div>\n      {position && (\n        <div>\n          <p>\n            Latitude: {position.coords.latitude} <br /> Longitude:{\" \"}\n            {position.coords.longitude}\n          </p>\n        </div>\n      )}\n      <div>\n        <button\n          onClick={() => {\n            setLoading(true);\n            getCurrentPosition()\n              .then((p) => {\n                setPosition(p);\n              })\n              .finally(() => {\n                setLoading(false);\n              });\n          }}\n        >\n          Get current position\n        </button>\n      </div>\n    </div>\n  );\n}\n```\n","readmeFilename":"README.md"}