##// END OF EJS Templates
added provided and configure methods to the fluent container configuration, added applyConfig method to the container
added provided and configure methods to the fluent container configuration, added applyConfig method to the container

File last commit:

r135:03e32ec7c20b ioc ts support
r142:be7edf08a115 v1.4.0-rc3 default
Show More
interfaces.ts
53 lines | 1.7 KiB | video/mp2t | TypeScriptLexer
/ src / main / ts / di / interfaces.ts
cin
changed the project structure
r49 import { ActivationContext } from "./ActivationContext";
cin
improved interfaces and more tight type checking
r120 export interface Descriptor<S extends object = any, T = any> {
cin
corrected code to support ts strict mode...
r115 activate(context: ActivationContext<S>): T;
cin
changed the project structure
r49 }
cin
improved interfaces and more tight type checking
r120 export type ServiceMap<S extends object> = {
cin
configuration interfaces moved to di/Configuration module...
r118 [k in keyof S]: Descriptor<S, S[k]>;
cin
corrected code to support ts strict mode...
r115 };
cin
improved interfaces and more tight type checking
r120 export type ContainerKeys<S extends object> = keyof S | keyof ContainerProvided<S>;
cin
working on fluent configuration
r133 export type TypeOfService<S extends object, K> =
cin
improved interfaces and more tight type checking
r120 K extends keyof ContainerProvided<S> ? ContainerProvided<S>[K] :
K extends keyof S ? S[K] : never;
export type ContainerServiceMap<S extends object> = {
cin
working on fluent configuration
r133 [K in ContainerKeys<S>]: Descriptor<S, TypeOfService<S, K>>;
cin
improved interfaces and more tight type checking
r120 };
export type PartialServiceMap<S extends object> = {
cin
configuration interfaces moved to di/Configuration module...
r118 [k in keyof S]?: Descriptor<S, S[k]>;
};
cin
corrected code to support ts strict mode...
r115
cin
working on fluent configuration
r133 export interface ServiceLocator<S extends object> {
resolve<K extends ContainerKeys<S>>(name: K, def?: TypeOfService<S, K>): TypeOfService<S, K>;
cin
improved interfaces and more tight type checking
r120 }
export interface ContainerProvided<S extends object> {
cin
working on fluent configuration
r133 container: ServiceLocator<S>;
cin
corrected code to support ts strict mode...
r115 }
cin
improved interfaces and more tight type checking
r120
export type ContainerRegistered<S extends object> = /*{
[K in Exclude<keyof S, keyof ContainerProvided<S>>]: S[K];
};*/
Exclude<S, ContainerProvided<S>>;
cin
configuration interfaces moved to di/Configuration module...
r118 export type ActivationType = "singleton" | "container" | "hierarchy" | "context" | "call";
cin
working on lifetime management
r129
cin
working on fluent configuration
r133 /**
* Интерфейс для управления жизнью экземпляра объекта. Каждая регистрация имеет
* свой собственный объект `ILifetime`, который создается при первой активации
*/
cin
working on lifetime management
r129 export interface ILifetime {
cin
working on fluent configuration
r133 /** Проверяет, что уже создан экземпляр объекта */
cin
working on lifetime management
r129 has(): boolean;
cin
working on services lifetime
r130
cin
working on lifetime management
r129 get(): any;
cin
working on services lifetime
r130
cin
working on fluent configuration, di annotations removed
r134 initialize(context: ActivationContext<any>): void;
cin
working on services lifetime
r130
cin
working on lifetime management
r129 store(item: any, cleanup?: (item: any) => void): void;
cin
working on fluent configuration
r132 }