Skip to content

Instantly share code, notes, and snippets.

@BerkeleyTrue BerkeleyTrue/ReactRx.js

Last active Sep 21, 2016
Embed
What would you like to do?
import { combineEpics } from 'redux-observables';
export function logOutEpic(actions, getState) {
return actions.ofType(....)
}
export function otherEpic(actions, getState) {
return actions.ofType(....)
}
export default combineEpics(logOutEpic, otherEpic);
import { ActionsObservable } from 'redux-observale/lib/ActionsObservable';
import rootEpic from './epics';
const flux = new Reactor({ /*...*/ });
const input$ = new Subject();
const actions$ = new ActionsObservable(input$);
const epic$ = new Subject();
epic$
::switchMap(epic => epic(action$, () => flux.evaluate([])))
.subscribe(({ type: action, payload }) => flux.dispatch(action, payload)));
// Setup initial root epic
epic$.next(rootEpic);
export function dispatch(action, payload) {
input$.next({ type: action, payload });
flux.dispatch(action, payload);
})
export default flux;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.