@amo-tm/wsc
Version:
The amo WSC component of the amo JS SDK
27 lines (26 loc) • 1.13 kB
TypeScript
import { ComponentContainer } from './component-container';
export declare const enum InstantiationMode {
LAZY = "LAZY",
EAGER = "EAGER"
}
export interface InstanceFactoryOptions {
options?: {};
}
/**
* Factory to create an instance of type T, given a ComponentContainer.
* ComponentContainer is the IOC container that provides {@link Provider}
* for dependencies.
*
* NOTE: The container only provides {@link Provider} rather than the actual instances of dependencies.
* It is useful for lazily loaded dependencies and optional dependencies.
*/
export declare type InstanceFactory<T extends Name> = (container: ComponentContainer, options: InstanceFactoryOptions) => NameServiceMapping[T] | Promise<NameServiceMapping[T]>;
/**
* This interface will be extended by Amo SDKs to provide service name and service type mapping.
* It is used as a generic constraint to ensure type safety.
*/
export interface NameServiceMapping {
}
export declare type Name = keyof NameServiceMapping;
export declare type Service = NameServiceMapping[Name];
export declare type RemoteInstanceUrl = string;