Last active
September 21, 2016 01:27
-
-
Save BerkeleyTrue/c72189e0add28a8d369c40813ef25ff5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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