Skip to content

Tab sync ​

reduxSyncMiddleware keeps the store in step across every open tab of the application. Each action is posted on a BroadcastChannel and dispatched again in the other tabs.

ts
import { reduxSyncMiddleware } from '@angular-redux2/store';

ngRedux.configureStore(rootReducer, INITIAL_STATE, [
    reduxSyncMiddleware({ initState: true, blacklist: [ 'ROUTER_NAVIGATION' ] })
]);

Options ​

OptionDefaultNotes
channelName'redux_state_sync'The channel the tabs share.
initStatefalseAsk an open tab for its state on start and take it over.
whitelist-Only these action types are shared.
blacklist-These action types are not shared.
predicate-A function deciding per action; it wins over both lists.
prepareStateidentityTransforms the state before it is sent to a new tab.
broadcastChannelOption{}Passed to broadcast-channel: type and webWorkerSupport.

SyncComponent is the class behind the middleware, and ConfigSyncInterface types the options.

See also ​

Released under the Mozilla Public License 2.0