Convert thunk to observable
function thunkToObservable(thunk) { | |
return (getState, ...args) => { | |
return new Observable(observer => { | |
const dispatchProxy = new Subject(); | |
const dispatch = action => dispatchProxy.next(action); | |
thunk(...args)(dispatch, getState); | |
return dispatchProxy.subscribe(observer); | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment