##// END OF EJS Templates
working on fluent configuration
working on fluent configuration

File last commit:

r133:09ea4b9e3735 ioc ts support
r133:09ea4b9e3735 ioc ts support
Show More
interfaces.ts
57 lines | 1.8 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 export interface ILifetimeManager {
initialize(context: ActivationContext<any>): ILifetime;
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
enter(): void;
cin
working on lifetime management
r129 store(item: any, cleanup?: (item: any) => void): void;
cin
working on fluent configuration
r132 }