DefinitelyTyped/types/redux-state-sync/redux-state-sync-tests.ts
2019-01-13 10:59:31 +08:00

23 lines
650 B
TypeScript

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