https://github.com/vic/redux-observable-adapter-xstream
Use xstream with redux-observable
https://github.com/vic/redux-observable-adapter-xstream
Last synced: 10 months ago
JSON representation
Use xstream with redux-observable
- Host: GitHub
- URL: https://github.com/vic/redux-observable-adapter-xstream
- Owner: vic
- License: mit
- Created: 2017-10-18T07:01:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-18T08:20:43.000Z (over 8 years ago)
- Last Synced: 2025-05-13T18:18:24.390Z (about 1 year ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# redux-observable-adapter-xstream
[](https://www.npmjs.com/package/redux-observable-adapter-xstream)
[](https://travis-ci.org/vic/redux-observable-adapter-xstream)
Use [xstream](https://github.com/staltz/xstream) with [redux-observable](https://github.com/redux-observable/redux-observable)
## Install
This requires peer dependencies of `rxjs@5` and `xstream`, which will have to be installed as well.
```sh
npm install --save redux-observable-adapter-xstream
```
## Usage
This library basically will convert the RxJS `ActionsObservable` provided to your Epics into a xstream version. Then the xstream you return in your Epic will be converted back to an RxJS Observable inside the middleware.
```js
import xstreamAdapter, {ofType} from 'redux-observable-adapter-xstream';
const epicMiddleware = createEpicMiddleware(rootEpic, { adapter: xstreamAdapter });
// your Epics are now xstreams
const pingPongEpic = action$ =>
action$
.filter(ofType(PING))
.map(action => ({
type: PONG
}));
```