{"id":17957551,"url":"https://github.com/itinance/redux-saga-location","last_synced_at":"2025-03-25T02:31:44.089Z","repository":{"id":21208779,"uuid":"91910031","full_name":"itinance/redux-saga-location","owner":"itinance","description":"Geo-Location-support for redux-saga","archived":false,"fork":false,"pushed_at":"2022-07-07T16:45:45.000Z","size":879,"stargazers_count":22,"open_issues_count":10,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T11:29:27.571Z","etag":null,"topics":["react-native","redux","redux-saga"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itinance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-20T18:58:15.000Z","updated_at":"2023-10-21T03:48:02.000Z","dependencies_parsed_at":"2022-09-13T22:22:17.898Z","dependency_job_id":null,"html_url":"https://github.com/itinance/redux-saga-location","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Fredux-saga-location","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Fredux-saga-location/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Fredux-saga-location/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Fredux-saga-location/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itinance","download_url":"https://codeload.github.com/itinance/redux-saga-location/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245195750,"owners_count":20575936,"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","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":["react-native","redux","redux-saga"],"created_at":"2024-10-29T10:55:35.652Z","updated_at":"2025-03-25T02:31:41.712Z","avatar_url":"https://github.com/itinance.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-saga-location\n\nGeoLocation within 'redux-saga'-context.\n\nThis library helps along to fetch geo-location within a saga (or any other generator function) and put the result into the redux-store.\n\n# Installation\n\n```bash\nyarn add redux-saga-location @react-native-community/geolocation\n```\n\nor\n\n```bash\nnpm install redux-saga-location @react-native-community/geolocation --save\n```\n\n# Setup\n\nIn the root reducer add the location-reducer. For instance:\n\n**reducer.js:**\n\n```javascript\nimport { locationReducer as location } from \"redux-saga-location\";\n\nconst appReducer = combineReducers({\n  appStates,\n  routes,\n  ...location\n});\n```\n\nIn the root saga spawn the channel watcher:\n\n**saga.js**\n\n```javascript\nimport {\n  watchLocationChannel,\n  getCurrentPosition,\n  watchCurrentPosition\n} from \"redux-saga-location\";\n\nexport default function* rootSaga() {\n  yield [\n    // ... all your sagas here\n    spawn(watchLocationChannel)\n  ];\n}\n```\n\n# Usage\n\n## Usage of getCurrentPosition\n\nWe call `getCurrentPosition` according to the [web-standard-method](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) and (if user permits) the current position will be put into the redux store.\n\n```javascript\nyield call(getCurrentPosition)\n```\n\nThe received data is the same as from [navigator.geolocation.getCurrentPosition](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition).\nStarting with react-native 0.60 navigator.geolocation has been removed and moved to [Geolocation.getCurrentPosition](https://github.com/react-native-community/react-native-geolocation)\n\n## Usage of watchCurrentPosition\n\nWe call `watchCurrentPosition` according to the [web-standard-method](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition) and (if user permits) the position will be put into the redux store as often as it gets updated.\n\n```javascript\nyield call(watchCurrentPosition)\n```\n\nThe received data is the same as from [navigator.geolocation.watchPosition](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition).\nStarting with react-native 0.60 navigator.geolocation has been removed and moved to [Geolocation.watchPosition](https://github.com/react-native-community/react-native-geolocation)\n\nWe can listen to the event in our reducers per \"REDUX_SAGA_LOCATION_SET_POSITION\", while errors can be detected with \"REDUX_SAGA_LOCATION_SET_ERROR\".\n\nIf we want to use constants for the actions, we can import them with:\n\n```javascript\nimport {\n  REDUX_SAGA_LOCATION_ACTION_SET_POSITION,\n  REDUX_SAGA_LOCATION_ACTION_SET_ERROR\n} from \"redux-saga-location/actions\";\n```\n\nWe'll find the result in our redux-store like this:\n\n![alt text](https://github.com/itinance/redux-saga-location/blob/master/instructions/redux-saga-location.png?raw=true)\n\n## Contribution:\n\nContributors are welcome! Feel free to submit pull requests or open [discussions](https://github.com/itinance/redux-saga-location/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitinance%2Fredux-saga-location","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitinance%2Fredux-saga-location","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitinance%2Fredux-saga-location/lists"}