Setu-TS
    Preparing search index...

    Class DiContainer

    A lazily compiled container, open until its owner calls close().

    const root = new DiContainer({ defaultScope: "singleton", autoRegister: false });
    root.register("port", { useValue: 3000 });
    root.close();
    const port = root.resolve<number>("port");

    0.1.0

    Implements

    Index
    localInstances: Map<ProviderEntry, unknown> | undefined

    Instances of scope-local registrations, allocated on first local resolve.

    0.11.0

    Internal owner of singleton instances.

    slots: unknown[] | undefined

    Internal slot storage, allocated on first scoped resolution.

    • Runs all owned cleanups in reverse creation order, once. Each asynchronous disposal has a fixed 5000 ms deadline; timeouts are recorded with the provider's name and later disposals still run. A timed-out disposal's later outcome is ignored. Synchronous disposals remain untimed and synchronous.

      Returns void | Promise<void>

      A promise only when cleanup is asynchronous

      After every cleanup runs, if any failed or timed out

      0.11.0

    • Resolves a token through its compiled graph.

      Type Parameters

      • T

      Parameters

      Returns T

      The resolved instance

      If wiring is invalid

      If root resolution reaches a scoped provider or creates a disposable transient outside a singleton dependency graph

      If this scope or its root is disposed

      0.11.0

    • Internal

      Internal ownership hook used only by compiled constructors.

      Parameters

      • cleanup: () => void | Promise<void>

        Disposal of a just-created instance

      • token: ContainerToken

        Provider identity used to name a disposal timeout

      Returns void

      Nothing

      0.11.0