import { BindingType, StatusType } from './constants'; import { Container } from './container'; import { Newable, Context, Options, CommonToken, RecordObject, DynamicValue, PostConstructParam, BindingActivationHandler, BindingDeactivationHandler } from './interfaces'; export interface InjectPropertiesResult { properties: RecordObject; bindings: Binding[]; } export declare class Binding { static _resolvers: Map unknown>; container?: Container; context?: Context; token: CommonToken; type: BindingType; status: StatusType; classValue?: Newable; constantValue?: T; dynamicValue?: DynamicValue; cache?: T; postConstructResult: Promise | symbol | undefined; transient: boolean; onActivationHandler?: BindingActivationHandler; onDeactivationHandler?: BindingDeactivationHandler; constructor(token: CommonToken, container: Container); onActivation(handler: BindingActivationHandler): void; onDeactivation(handler: BindingDeactivationHandler): void; activate(input: T): T; deactivate(): void; to(constructor: Newable): this; toSelf(): this; toConstantValue(value: T): this; toDynamicValue(func: DynamicValue): this; inTransientScope(): this; toService(token: CommonToken): this; get(options: Options): unknown; _getAwaitBindings(bindings: Binding[], filter: PostConstructParam): Binding[]; /** * PostConstruct 生命周期处理 * * postConstructResult 的三种状态: * - UNINITIALIZED(Symbol):PostConstruct 尚未执行,用于循环依赖检测 * - undefined:没有使用 @PostConstruct 装饰器,或 @PostConstruct() 无参数时同步执行完毕 * - Promise:@PostConstruct(value) 有参数时,等待前置服务初始化后异步执行 * * @PostConstruct() 无参数时:同步执行,不等待任何前置服务 * @PostConstruct(value) 有参数时:等待指定的前置服务初始化完成后再执行 * - 如果前置服务初始化成功,执行当前服务的 PostConstruct 方法 * - 如果前置服务初始化失败,rejected promise 自然传播,当前服务的 PostConstruct 不执行 */ _postConstruct(options: Options, propertyBindings: Binding[]): void; preDestroy(): void; _execute(key: string): any; _resolveInstanceValue(options: Options): T; _createInstance(): T; _registerInstance(): void; _injectProperties(properties: RecordObject): void; _resolveConstantValue(): T; _resolveDynamicValue(): T; _getInjectProperties(options: Options): { properties: RecordObject; bindings: Binding[]; }; }