ing
This commit is contained in:
parent
046ea0e6f2
commit
57acc39ee2
|
@ -28,7 +28,7 @@ export class InstanceFactory implements InstanceDefinitionRegistry {
|
|||
* getInstance
|
||||
*/
|
||||
public getInstance(name: InstanceNameType, requiredType: ClassType, ...args: any[]): any | undefined {
|
||||
if (null === name) {
|
||||
if (undefined === name) {
|
||||
name = requiredType.name;
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,7 @@ export class InstanceFactory implements InstanceDefinitionRegistry {
|
|||
|
||||
private getSingleton(name: InstanceNameType): any | undefined {
|
||||
let singletonObject = this._singletonObjects.get(name);
|
||||
return singletonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,10 @@ import {
|
|||
Instance,
|
||||
} from '@overflow/commons/application/decorators';
|
||||
import { Value } from '@overflow/commons/di/decorators';
|
||||
import {
|
||||
createHashHistory,
|
||||
History,
|
||||
} from 'history';
|
||||
|
||||
@Configuration()
|
||||
export class WebAppConfiguration {
|
||||
|
@ -10,10 +14,10 @@ export class WebAppConfiguration {
|
|||
private htmlContainerID: string;
|
||||
|
||||
/**
|
||||
* container
|
||||
* containerPromise
|
||||
*/
|
||||
@Instance()
|
||||
public container(): Promise<HTMLElement> {
|
||||
public containerPromise(): Promise<HTMLElement> {
|
||||
function getContainer(containerID: string): Promise<HTMLElement> {
|
||||
return new Promise<HTMLElement>(resolve => {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
@ -24,4 +28,13 @@ export class WebAppConfiguration {
|
|||
|
||||
return getContainer(this.htmlContainerID);
|
||||
}
|
||||
|
||||
/**
|
||||
* history
|
||||
*/
|
||||
@Instance()
|
||||
public history(): History {
|
||||
return createHashHistory();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,12 +79,13 @@ class WebAppApplication extends B {
|
|||
private static isProduction:boolean = process.env.NODE_ENV === 'production' ? true : false;
|
||||
private static useReduxDevTools:boolean = window.devToolsExtension && !WebAppApplication.isProduction ? true : false;
|
||||
|
||||
@Value('html.container.id')
|
||||
private htmlContainerID: string;
|
||||
@Resource()
|
||||
private containerPromise: Promise<HTMLElement>;
|
||||
private container: HTMLElement;
|
||||
|
||||
@Resource()
|
||||
private store: Store<any>;
|
||||
@Resource()
|
||||
private history: History;
|
||||
|
||||
@Inject()
|
||||
|
@ -93,7 +94,7 @@ class WebAppApplication extends B {
|
|||
@Runner()
|
||||
public async run(): Promise<void> {
|
||||
try {
|
||||
this.container = await this.getContainer();
|
||||
this.container = await this.containerPromise;
|
||||
this.renderLoading();
|
||||
let reducer: WebAppDispatcherReducer = new WebAppDispatcherReducer();
|
||||
reducer.registerReducers(config.redux.reducers);
|
||||
|
@ -105,18 +106,6 @@ class WebAppApplication extends B {
|
|||
}
|
||||
}
|
||||
|
||||
private getContainer(): Promise<HTMLElement> {
|
||||
function getContainer(containerID: string): Promise<HTMLElement> {
|
||||
return new Promise<HTMLElement>(resolve => {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
resolve(document.getElementById(containerID));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return getContainer(this.htmlContainerID);
|
||||
}
|
||||
|
||||
private renderLoading(): void {
|
||||
ReactDOM.render(
|
||||
<div style={{
|
||||
|
|
Loading…
Reference in New Issue
Block a user