Interface ComponentInstanceFactory<ServiceType>

Interface which must be implemented by an component implementation when the flag instanceFactory is set to true. Then the component is a factory which creates a service implementation.

interface ComponentInstanceFactory<
    ServiceType extends ServiceInstance = ServiceInstance,
> {
    createInstance(): ServiceType;
    destroyInstance(instance: ServiceType): void | Promise<void>;
}

Type Parameters

Methods

  • Creates a new service instance. The returned service instance is registered as a service at the app runtime.

    Returns ServiceType

  • Cleans up the service instance during shutdown.

    Parameters

    Returns void | Promise<void>