This commit is contained in:
AOHUA MU
2019-01-13 10:59:31 +08:00
parent 8176350042
commit af37e28143
3 changed files with 11 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
// Definitions by: MU AOHUA <https://github.com/AOHUA>
// AntonioMendez <https://github.com/AntonioMendez>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import { Store, Reducer, Middleware, AnyAction } from "redux";
import BroadcastChannel from "broadcast-channel";

View File

@@ -0,0 +1,7 @@
{
"private": true,
"dependencies": {
"broadcast-channel": "^2.1.8",
"redux": "^4.0.1"
}
}

View File

@@ -6,19 +6,17 @@ interface TestState {
b: string;
c: string;
}
const middlewares = [
createStateSyncMiddleware({
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(middlewares));
const store = createStore(withReduxStateSync(rootReducer), ['test'], applyMiddleware(middleware));
initStateWithPrevTab(store);