@malagu/core
Version:
58 lines • 2.09 kB
TypeScript
import { interfaces } from 'inversify';
import { Scope } from '../container/scope';
export declare type ComponentId<T = any> = interfaces.ServiceIdentifier<T>;
export declare const COMPONENT_TAG = "Component";
export interface ComponentOption {
id?: ComponentId | ComponentId[];
scope?: Scope;
name?: string | number | symbol;
tag?: {
tag: string | number | symbol;
value: any;
};
default?: boolean;
when?: (request: interfaces.Request) => boolean;
rebind?: boolean;
proxy?: boolean;
sysTags?: string[];
onActivation?: (context: interfaces.Context, t: any) => any;
}
export interface ComponentMetadata {
ids: ComponentId[];
scope: Scope;
name?: string | number | symbol;
tag?: {
tag: string | number | symbol;
value: any;
};
default?: boolean;
when?: (request: interfaces.Request) => boolean;
rebind: boolean;
proxy: boolean;
sysTags: string[];
onActivation?: (context: interfaces.Context, t: any) => any;
target: any;
}
export declare type IdOrComponentOption = ComponentId | ComponentId[] | ComponentOption;
export interface ComponentDecorator {
(idOrOption?: IdOrComponentOption): ClassDecorator;
(...ids: ComponentId[]): ClassDecorator;
}
export declare const Component: ComponentDecorator;
export declare function parseComponentOption(target: any, idOrOption: any): {
id?: string | symbol | interfaces.Abstract<any> | ComponentId<any>[] | undefined;
scope?: Scope | undefined;
name?: string | number | symbol | undefined;
tag?: {
tag: string | number | symbol;
value: any;
} | undefined;
default?: boolean | undefined;
when?: ((request: interfaces.Request) => boolean) | undefined;
rebind?: boolean | undefined;
proxy?: boolean | undefined;
sysTags?: string[] | undefined;
onActivation?: ((context: interfaces.Context, t: any) => any) | undefined;
};
export declare function applyComponentDecorator(option: ComponentOption, target: any): ComponentMetadata;
//# sourceMappingURL=component.d.ts.map