UNPKG

async-injection

Version:

A robust lightweight dependency injection library for TypeScript.

22 lines (21 loc) 890 B
import { BindableProvider } from './bindable-provider'; import { SyncFactory } from './binding'; import { InjectableId, Injector } from './injector'; import { State } from './state'; /** * @inheritDoc * This specialization simply invokes it's configured Factory and provides the result. */ export declare class FactoryBasedProvider<T> extends BindableProvider<T, SyncFactory<T>> { constructor(injector: Injector, id: InjectableId<T>, maker: SyncFactory<T>); /** * @inheritDoc * This specialization invokes it's configured Factory and provides the result (or invokes the error handler if necessary). */ provideAsState(): State<T>; /** * @inheritDoc * This specialization returns undefined anytime 'asyncOnly' is true (since this Provider is by definition synchronous). */ resolveIfSingleton(asyncOnly: boolean): Promise<T> | undefined; }