UNPKG

@shopgate/pwa-common

Version:

Common library for the Shopgate Connect PWA.

5 lines 582 B
import{Subject}from'rxjs/Subject';import{UIEvents}from'@shopgate/pwa-core';export var mainSubject=new Subject();/** * Connects the redux store with RxJS and Observable streams. * @param {Object} store The redux store. * @return {Function} */var observableMiddleware=function observableMiddleware(store){return function(next){return function(action){var prevState=store.getState();var result=next(action);mainSubject.next({action:action,dispatch:store.dispatch,events:UIEvents,getState:store.getState,prevState:prevState});return result;};};};export default observableMiddleware;