This commit is contained in:
crusader 2017-12-26 19:26:58 +09:00
parent 5d268cfbf7
commit 187a3ed10a
4 changed files with 24 additions and 3 deletions

View File

@ -0,0 +1,3 @@
export * from './inject';
export * from './injectable';
export * from './resource';

View File

@ -21,7 +21,7 @@ export default class DispatchReducer {
private reducerMap: Map<string, any[]>; private reducerMap: Map<string, any[]>;
public constructor() { protected constructor() {
this.reducerMap = new Map(); this.reducerMap = new Map();
} }

View File

@ -28,9 +28,12 @@ import {
AppContainer, AppContainer,
} from 'react-hot-loader'; } from 'react-hot-loader';
import { Inject } from '@overflow/commons/di/decorators';
import config from './config'; import config from './config';
import DispatchReducer from '@overflow/commons/redux/dispatch_reducer'; import WebAppDispatchReducer from './redux/webapp_dispatch_reducer';
import WebApp from './pages/webapp'; import WebApp from './pages/webapp';
// declare let module: { hot: any }; // declare let module: { hot: any };
declare global { declare global {
@ -51,6 +54,9 @@ class WebAppApplication {
private store: Store<any>; private store: Store<any>;
private history: History; private history: History;
@Inject()
private dispatchReducer: WebAppDispatchReducer;
public constructor() { public constructor() {
this.container = document.getElementById('appContainer'); this.container = document.getElementById('appContainer');
this.history = createHashHistory(); this.history = createHashHistory();
@ -59,7 +65,7 @@ class WebAppApplication {
public async run(): Promise<void> { public async run(): Promise<void> {
try { try {
this.renderLoading(); this.renderLoading();
let reducer: DispatchReducer = new DispatchReducer(); let reducer: WebAppDispatchReducer = new WebAppDispatchReducer();
reducer.registerReducers(config.redux.reducers); reducer.registerReducers(config.redux.reducers);
this.store = createStore(reducer.reducer, config.redux.state); this.store = createStore(reducer.reducer, config.redux.state);

View File

@ -0,0 +1,12 @@
import {
Injectable,
} from '@overflow/commons/di/decorators';
import DispatchReducer from '@overflow/commons/redux/dispatch_reducer';
@Injectable()
export default class WebAppDispatchReducer extends DispatchReducer {
public constructor() {
super();
}
}