@omnia/fx
Version:
Provide Omnia Fx typings and tooling for clientside Omnia development.
28 lines (27 loc) • 1.05 kB
TypeScript
type Class = {
new (...args: any[]): any;
};
interface MockInstance {
type: any;
instance: any;
}
export declare class ServiceContainer {
private static mockInstances;
private static registeredOnDisposing;
static addMock<T>(type: T, instance: any): void;
static getMock<T extends Class = any>(type: T): MockInstance;
/**
* @param forceNewInstanceLifetimeScope that used in Provide/Inject pattern in ui layer.
*/
static createInstance<T, T2 extends Class = any>(classType: T2, constructorArgs?: T, forceNewInstanceLifetimeScope?: boolean): InstanceType<T2>;
static disposeScopedAndTransient(): void;
static onDisposing(func: (instance: any) => void): void;
static getRegisteredOnDisposing(): ((activatedInstance: any) => void)[];
}
export declare class ServiceContainerContext {
private container;
constructor();
createInstance<T, T2 extends Class = any>(classType: T2, constructorArgs?: T, forceNewInstanceLifetimeScope?: boolean): InstanceType<T2>;
dispose(): void;
}
export {};