Skip to content
Oeiuwq Faith Blog OpenSource Porfolio

vic/redux-observable-adapter-xstream

Use xstream with redux-observable

vic/redux-observable-adapter-xstream.json
{
"defaultBranch": "master",
"description": "Use xstream with redux-observable",
"fullName": "vic/redux-observable-adapter-xstream",
"homepage": "",
"language": "JavaScript",
"name": "redux-observable-adapter-xstream",
"pushedAt": "2017-10-18T08:20:43Z",
"stargazersCount": 4,
"updatedAt": "2022-09-06T13:40:21Z",
"url": "https://github.com/vic/redux-observable-adapter-xstream"
}

npm Travis

Use xstream with redux-observable

This requires peer dependencies of rxjs@5 and xstream, which will have to be installed as well.

Terminal window
npm install --save redux-observable-adapter-xstream

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.

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
}));