mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* update types * update test case * add test case * update version * update header Co-authored-by: aohua <aohua@percy.sg>
25 lines
732 B
TypeScript
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);
|