Http Kernel!
This commit is contained in:
22
lib/src/lifecycle/AppClass.ts
Normal file
22
lib/src/lifecycle/AppClass.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import Instantiable from '../../../di/src/type/Instantiable.ts'
|
||||
import {DependencyKey} from '../../../di/src/type/DependencyKey.ts'
|
||||
import {make} from '../../../di/src/global.ts'
|
||||
import Application from '../lifecycle/Application.ts'
|
||||
|
||||
export default class AppClass {
|
||||
protected static make<T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) {
|
||||
return make(target, ...parameters)
|
||||
}
|
||||
|
||||
protected static get app() {
|
||||
return make(Application)
|
||||
}
|
||||
|
||||
protected make<T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) {
|
||||
return make(target, ...parameters)
|
||||
}
|
||||
|
||||
protected get app() {
|
||||
return make(Application)
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,13 @@ import { Collection } from '../collection/Collection.ts'
|
||||
import {container, make} from '../../../di/src/global.ts'
|
||||
import {DependencyKey} from '../../../di/src/type/DependencyKey.ts'
|
||||
import Instantiable, {isInstantiable} from '../../../di/src/type/Instantiable.ts'
|
||||
import AppClass from './AppClass.ts'
|
||||
|
||||
const isLifecycleUnit = (something: any): something is (typeof LifecycleUnit) => {
|
||||
return isInstantiable(something) && something.prototype instanceof LifecycleUnit
|
||||
}
|
||||
|
||||
export default abstract class LifecycleUnit {
|
||||
export default abstract class LifecycleUnit extends AppClass {
|
||||
private _status = Status.Stopped
|
||||
|
||||
public get status() {
|
||||
@@ -34,8 +35,4 @@ export default abstract class LifecycleUnit {
|
||||
}
|
||||
return new Collection<typeof LifecycleUnit>()
|
||||
}
|
||||
|
||||
protected make<T>(target: Instantiable<T>|DependencyKey, ...parameters: any[]) {
|
||||
return make(target, ...parameters)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user