diff --git a/src/ts/@overflow/commons/di/decorators/index.ts b/src/ts/@overflow/commons/di/decorators/index.ts new file mode 100644 index 0000000..122f27a --- /dev/null +++ b/src/ts/@overflow/commons/di/decorators/index.ts @@ -0,0 +1,3 @@ +export * from './inject'; +export * from './injectable'; +export * from './resource'; diff --git a/src/ts/@overflow/commons/redux/dispatch_reducer.ts b/src/ts/@overflow/commons/redux/dispatch_reducer.ts index 9d59c5f..2acc51b 100644 --- a/src/ts/@overflow/commons/redux/dispatch_reducer.ts +++ b/src/ts/@overflow/commons/redux/dispatch_reducer.ts @@ -21,7 +21,7 @@ export default class DispatchReducer { private reducerMap: Map; - public constructor() { + protected constructor() { this.reducerMap = new Map(); } diff --git a/src/ts/@overflow/webapp/index.tsx b/src/ts/@overflow/webapp/index.tsx index 2998bda..2c3493f 100644 --- a/src/ts/@overflow/webapp/index.tsx +++ b/src/ts/@overflow/webapp/index.tsx @@ -28,9 +28,12 @@ import { AppContainer, } from 'react-hot-loader'; +import { Inject } from '@overflow/commons/di/decorators'; + import config from './config'; -import DispatchReducer from '@overflow/commons/redux/dispatch_reducer'; +import WebAppDispatchReducer from './redux/webapp_dispatch_reducer'; import WebApp from './pages/webapp'; + // declare let module: { hot: any }; declare global { @@ -51,6 +54,9 @@ class WebAppApplication { private store: Store; private history: History; + @Inject() + private dispatchReducer: WebAppDispatchReducer; + public constructor() { this.container = document.getElementById('appContainer'); this.history = createHashHistory(); @@ -59,7 +65,7 @@ class WebAppApplication { public async run(): Promise { try { this.renderLoading(); - let reducer: DispatchReducer = new DispatchReducer(); + let reducer: WebAppDispatchReducer = new WebAppDispatchReducer(); reducer.registerReducers(config.redux.reducers); this.store = createStore(reducer.reducer, config.redux.state); diff --git a/src/ts/@overflow/webapp/redux/webapp_dispatch_reducer.ts b/src/ts/@overflow/webapp/redux/webapp_dispatch_reducer.ts new file mode 100644 index 0000000..74919bf --- /dev/null +++ b/src/ts/@overflow/webapp/redux/webapp_dispatch_reducer.ts @@ -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(); + } +}