ing
This commit is contained in:
parent
81b76fb8b9
commit
9a95712637
|
@ -12,10 +12,10 @@ import {
|
|||
} from '@loafer/core/reflect';
|
||||
|
||||
import {
|
||||
InjectableAnnotation,
|
||||
} from '@loafer/pouches/decorator/Injectable';
|
||||
ConfigurationAnnotation,
|
||||
} from '@loafer/context/decorator/Configuration';
|
||||
|
||||
export class AppAnnotation extends InjectableAnnotation implements DecoratorHandler {
|
||||
export class AppAnnotation extends ConfigurationAnnotation implements DecoratorHandler {
|
||||
public constructor(qualifier?: PropertyType) {
|
||||
super(qualifier);
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
import PouchFactory from '@loafer/pouches/factory/PouchFactory';
|
||||
import DefaultPouchFactory from '@loafer/pouches/factory/implement/DefaultPouchFactory';
|
||||
|
||||
interface AppContext extends PouchFactory {
|
||||
interface ApplicationContext extends PouchFactory {
|
||||
getPouchFactory(): DefaultPouchFactory;
|
||||
}
|
||||
|
||||
export default AppContext;
|
||||
export default ApplicationContext;
|
|
@ -3,11 +3,11 @@ import {
|
|||
PropertyType,
|
||||
} from '@loafer/core/constants/types';
|
||||
|
||||
import AppContext from '@loafer/context/AppContext';
|
||||
import ApplicationContext from '@loafer/context/ApplicationContext';
|
||||
|
||||
import DefaultPouchFactory from '@loafer/pouches/factory/implement/DefaultPouchFactory';
|
||||
|
||||
class DefaultAppContext implements AppContext {
|
||||
class DefaultAppContext implements ApplicationContext {
|
||||
private readonly pouchFactory: DefaultPouchFactory;
|
||||
|
||||
public constructor() {
|
|
@ -0,0 +1,7 @@
|
|||
import GenericApplicationContext from '@loafer/context/support/GenericApplicationContext';
|
||||
|
||||
export class AnnotationConfigApplicationContext extends GenericApplicationContext {
|
||||
|
||||
}
|
||||
|
||||
export default AnnotationConfigApplicationContext;
|
|
@ -1,24 +0,0 @@
|
|||
import Action from '@overflow/commons/redux/Action';
|
||||
|
||||
// Action Type
|
||||
export type INITIALIZED = '@overflow/commons/context/INITIALIZED';
|
||||
export type WILL_DESTROY = '@overflow/commons/context/WILL_DESTROY';
|
||||
|
||||
export const INITIALIZED: INITIALIZED = '@overflow/commons/context/INITIALIZED';
|
||||
export const WILL_DESTROY: WILL_DESTROY = '@overflow/commons/context/WILL_DESTROY';
|
||||
|
||||
// Action Creater
|
||||
export type initialized = () => Action;
|
||||
export type willDestroy = () => Action;
|
||||
|
||||
export const initialized: initialized = (): Action => {
|
||||
return {
|
||||
type: INITIALIZED,
|
||||
};
|
||||
};
|
||||
|
||||
export const willDestroy: willDestroy = (): Action => {
|
||||
return {
|
||||
type: WILL_DESTROY,
|
||||
};
|
||||
};
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { call, fork, take } from 'redux-saga/effects';
|
||||
|
||||
import * as LifecycleActions from '../action/lifecycle';
|
||||
|
||||
import AppContext from '../../AppContext';
|
||||
|
||||
|
||||
function _destroy(): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
// AppContext.getInstance().destroy();
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
function* destroy(): SagaIterator {
|
||||
yield take(LifecycleActions.WILL_DESTROY);
|
||||
yield call(_destroy);
|
||||
}
|
||||
|
||||
|
||||
export default function* root(): SagaIterator {
|
||||
yield fork(destroy);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
export abstract class AbstractApplicationContext {
|
||||
|
||||
}
|
||||
|
||||
export default AbstractApplicationContext;
|
|
@ -0,0 +1,7 @@
|
|||
import AbstractApplicationContext from '@loafer/context/support/AbstractApplicationContext';
|
||||
|
||||
export class GenericApplicationContext extends AbstractApplicationContext {
|
||||
|
||||
}
|
||||
|
||||
export default GenericApplicationContext;
|
|
@ -44,11 +44,10 @@ import * as injectTapEventPlugin from 'react-tap-event-plugin';
|
|||
import Application from '@loafer/application/Application';
|
||||
import ApplicationStater from '@loafer/application/ApplicationStater';
|
||||
import Platform from '@overflow/commons/platform';
|
||||
import App from '@loafer/context/decorator/App';
|
||||
import App from '@loafer/application/decorator/App';
|
||||
import Inject from '@loafer/pouches/decorator/Inject';
|
||||
import AppContext from '@loafer/context/AppContext';
|
||||
|
||||
import * as AppContextLifecycleActions from '@loafer/context/redux/action/lifecycle';
|
||||
import WebSocketRPC from '@overflow/commons/websocket/WebSocketRPC';
|
||||
import ReducerContext from '@overflow/commons/redux/ReducerContext';
|
||||
import { SagaWatcher } from '@overflow/commons/constant';
|
||||
|
@ -103,8 +102,6 @@ class OFApplication implements ApplicationStater {
|
|||
|
||||
await this.initRedux();
|
||||
|
||||
this.store.dispatch(AppContextLifecycleActions.initialized());
|
||||
|
||||
this.displayApp();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
|
Loading…
Reference in New Issue
Block a user