-
Notifications
You must be signed in to change notification settings - Fork 0
Services
Big Mogician edited this page Dec 9, 2018
·
3 revisions
- Context
// 基础上下文服务
class Context<T extends IContext> = {}> {
readonly ctx: T;
}
- Configs
// 全局配置容器服务
class Configs implements ReadonlyConfigs {
// 获取配置
get<T>(token: ConfigToken<T>): T;
}
- InjectService
// 依赖注入服务
class InjectService {
// 当前范围ID
readonly scopeId: ScopeID;
// 获取实例
get<T>(token: InjectDIToken<T>): T;
}
- AstroboyContext
// astroboy 基础上下文
class AstroboyContext<T = IContext, A = Koa.Application, C = any> {
/** BaseClass.ctx */
readonly ctx: T;
/** BaseClass.app */
readonly app: A;
/** BaseClass.config */
readonly config: C;
getConfig(...args: any[]): any;
getServiceClass(...args: any[]): any;
getService(...args: any[]): any;
callService(...args: any[]): any;
invokeServiceMethod(...args: any[]): any;
getLib(...args: any[]): any;
}