DefinitelyTyped/types/redux-state-sync/redux-state-sync-tests.ts
MU AOHUA 0751ca13d0
Update types for Redux-state-sync (#42979)
* update types

* update test case

* add test case

* update version

* update header

Co-authored-by: aohua <aohua@percy.sg>
2020-03-10 12:36:25 -07:00

25 lines
732 B
TypeScript

import { createStore, applyMiddleware, Action } from "redux";
import { createStateSyncMiddleware, initStateWithPrevTab, withReduxStateSync, initMessageListener } from "redux-state-sync";
interface TestState {
a: number;
b: string;
c: string;
}
const middleware = createStateSyncMiddleware({
channel: 'test',
predicate: (action) => true,
blacklist: [],
whitelist: [],
broadcastChannelOption: {},
prepareState: (state) => state,
});
function rootReducer(state: TestState, action: Action): TestState {
return state;
}
const store = createStore(withReduxStateSync(rootReducer, (state) => state), ['test'], applyMiddleware(middleware));
initStateWithPrevTab(store);
initMessageListener(store);