Function reduxSyncMiddleware

  • Sync redux state across browser tabs A lightweight middleware to sync your redux state across browser tabs. It will listen to the Broadcast Channel and dispatch the same actions dispatched in other tabs to keep the redux state in sync.

    Example

    constructor(ngRedux: NgRedux<IAppState>, devTools: DevToolsExtension) {
    let enhancer: Array<any> = [];

    if (devTools.enhancer() && isDevMode())
    enhancer = [ devTools.enhancer() ];

    ngRedux.configureStore(<any> rootReducer, INITIAL_STATE, [
    reduxSyncMiddleware({ initState: true })
    ], enhancer);
    }

    Before you use

    Please take note that BroadcastChannel can only send data that is supported by the structured clone algorithm (Strings, Objects, Arrays, Blobs, ArrayBuffer, Map), so you need to make sure that the actions that you want to send to other tabs don't include any functions in the payload.`

    Parameters

    Returns Middleware

Generated using TypeDoc