rage-framework
Version:
## How to Install *server-side* ```bash npm install @rage-framework/server ```
33 lines (32 loc) • 1.46 kB
TypeScript
import { ContainerInstance } from './ContainerInstance';
import { Token } from './Token';
import { Handler } from './types/Handler';
import { ObjectType } from './types/ObjectType';
import { ServiceIdentifier } from './types/ServiceIdentifier';
import { ServiceMetadata } from './types/ServiceMetadata';
export declare class Container {
private static readonly globalInstance;
private static readonly instances;
static readonly handlers: Map<Handler, Handler>;
static of(instanceId: any): ContainerInstance;
static has<T>(type: ObjectType<T>): boolean;
static has<T>(id: string): boolean;
static has<T>(id: Token<T>): boolean;
static get<T>(type: ObjectType<T>): T;
static get<T>(id: string): T;
static get<T>(id: Token<T>): T;
static get<T>(service: {
service: T;
}): T;
static getMany<T>(id: string): T[];
static getMany<T>(id: Token<T>): T[];
static set<T, K extends keyof T>(service: ServiceMetadata<T, K>): Container;
static set(type: Function, value: any): Container;
static set(name: string, value: any): Container;
static set(token: Token<any>, value: any): Container;
static set<T, K extends keyof T>(values: ServiceMetadata<T, K>[]): Container;
static remove(...ids: ServiceIdentifier[]): Container;
static reset(containerId?: any): Container;
static registerHandler(handler: Handler): Container;
static import(services: Function[]): Container;
}