{"id":23186089,"url":"https://github.com/termosa/use-geo","last_synced_at":"2026-02-12T04:05:56.304Z","repository":{"id":57388085,"uuid":"313112649","full_name":"termosa/use-geo","owner":"termosa","description":"Make use of browser geo location API","archived":false,"fork":false,"pushed_at":"2024-11-19T03:00:37.000Z","size":692,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T09:46:55.979Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/termosa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-11-15T20:02:03.000Z","updated_at":"2024-11-19T03:00:41.000Z","dependencies_parsed_at":"2025-07-28T09:38:36.701Z","dependency_job_id":"1c37a6d7-96b2-45df-976c-0f86d8f0e5ee","html_url":"https://github.com/termosa/use-geo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/termosa/use-geo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termosa%2Fuse-geo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termosa%2Fuse-geo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termosa%2Fuse-geo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termosa%2Fuse-geo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/termosa","download_url":"https://codeload.github.com/termosa/use-geo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/termosa%2Fuse-geo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270989581,"owners_count":24680771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-18T10:14:35.491Z","updated_at":"2026-02-12T04:05:51.279Z","avatar_url":"https://github.com/termosa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# use-geo\n\n\u003e Make use of browser geo location API\n\n[![NPM](https://img.shields.io/npm/v/use-geo.svg)](https://www.npmjs.com/package/use-geo) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Install\n\n```bash\nnpm install --save use-geo\n```\n\n## Usage\n\n### Manual position request\n\n```tsx\nimport * as React from 'react';\n\nimport { useGeo } from 'use-geo';\n// Or import useGeo from 'use-geo';\n\nconst stringifyResults = (status, position, error) =\u003e {\n  if (error) return `Error(${error.message})`;\n  if (position) return `{\\n  lat: ${position.coords.latitude},\\n  long: ${position.coords.longitude}\\n}`;\n  return status;\n};\n\nexport default () =\u003e {\n  const { status, position, error, request } = useGeo(/* immediate flag (boolean) or PositionOptions object */);\n\n  return (\n    \u003cdiv\u003e\n      \u003cinput\n        type=\"button\"\n        value=\"reload\"\n        onClick={request}\n        disabled={status === Status.PENDING}\n      /\u003e\n      \u003cpre\u003euseGeo(): {stringifyResults(status, position, error)}\u003c/pre\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n### Watching position changes\n\n```tsx\nimport * as React from 'react';\n\nimport { useGeoWatch } from 'use-geo';\n\nconst stringifyResults = (position, error) =\u003e {\n  if (error) return `Error(${error.message})`;\n  if (position) return `{\\n  lat: ${position.coords.latitude},\\n  long: ${position.coords.longitude}\\n}`;\n  return 'No results';\n};\n\nexport default () =\u003e {\n  const { position, error, watching, watch, unwatch } = useGeoWatch(/* immediate flag (boolean) or PositionOptions object */);\n\n  return (\n    \u003cdiv\u003e\n      {watching ? 'watching' : 'not watching'}\n      \u003cinput\n        type=\"button\"\n        value={watching ? 'stop' : 'start'}\n        onClick={watching ? unwatch : watch}\n      /\u003e\n      \u003cpre\u003euseGeo(): {stringifyResults(position, error)}\u003c/pre\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n## License\n\nMIT © [termosa](https://github.com/termosa)\n\n---\n\nThis hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermosa%2Fuse-geo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftermosa%2Fuse-geo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftermosa%2Fuse-geo/lists"}