Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/recruit-tech/redux-effects-geolocation
redux-effects middleware for Geolocation API
https://github.com/recruit-tech/redux-effects-geolocation
Last synced: about 11 hours ago
JSON representation
redux-effects middleware for Geolocation API
- Host: GitHub
- URL: https://github.com/recruit-tech/redux-effects-geolocation
- Owner: recruit-tech
- License: mit
- Created: 2016-07-22T13:06:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-26T06:52:39.000Z (over 7 years ago)
- Last Synced: 2024-04-24T16:10:57.131Z (7 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 4
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# redux-effects-geolocation
[redux-effects](https://github.com/redux-effects/redux-effects)
middleware for Geolocation API.## Installation
```
npm install --save redux-effects-geolocation
```## Usage
### Installing the middleware
```javascript
import { createStore, applyMiddleware } from 'redux';
import geoMiddleware from 'redux-effects-geolocation';
import rootReducer from './reducers';const store = createStore(
rootReducer,
applyMiddleware(
geoMiddleware()
)
);
```### Using Actions:
getting current position:
```javascript
import { getPosition } from 'redux-effects-geolocation';const promise = store.dispatch(getPosition());
```getting current position with options:
```javascript
import { getPosition } from 'redux-effects-geolocation';const promise = store.dispatch(getPosition({ enableHighAccuracy: true }));
```Note: If Geolocation API is not available, the Promise is always rejected.
## API
### Action Creators
#### `getPosition([options])`
###### Arguments
* `options` *(Object)*: See
[MDN](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions)
for more info.##### Returns
* *(Object)*: An action object.