Vinyl
    Preparing search index...

    Type Alias Factory<T>

    Factory: (deps: any, add: AddDisposable) => T

    A factory function that produces a dependency. Called at most once per container lifecycle.

    Type Parameters

    • T

    Type declaration

      • (deps: any, add: AddDisposable): T
      • Parameters

        • deps: any

          A statically-typed record of other dependencies required by this factory, provided by other factories.

        • add: AddDisposable

          A function used to register disposables or cleanup callbacks. Use this to add teardown logic that should run when the container is disposed.

        Returns T

        The constructed dependency. If it:

        • Implements Disposable, it will automatically be disposed when the container is disposed. Do not manually pass it to add.
        • Is PromiseLike, the container will wait for the promise to resolve. If the resolved value implements Disposable, it will also be disposed automatically. Additionally, the promise will reject if the container is disposed before resolution.