iya-sts
    Preparing search index...

    Class export=<T>

    The one place a converted module's instance lives, built by the composition root or, without one, by default.

    The root installs the instance it built; every facade reaches it through get(). A service in which any module built its own instance does not start.

    Type Parameters

    • T extends object
    Index
    • Creates an empty slot for one module.

      Type Parameters

      • T extends object

      Parameters

      • name: string

        the module's path, for messages

      • build: () => T

        makes the default instance from the module's default dependencies

      • wire: (instance: T) => void

        the module's own work with an instance, run once for whichever instance is installed; null for none

      • log: SlotLog

        the logger to write to

      Returns export=<T>

    • Builds and wires the default instance now, unless a composition root has called deferToRoot().

      The last statement of every module on this pattern, so loading a module without the root behaves as loading it did before R2.

      Returns void

    • Makes a facade function for one method: the same call, on whichever instance get() answers at call time.

      The facade is named bound <key>, as the pre-R2 bound methods were, so the route list and stack traces read the same.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • key: K

        the method's name

      Returns T[K]

      the facade function

    • Returns the installed instance, building, wiring and recording a default one first when nothing is installed.

      Returns T

      the module's instance

    • Installs the instance the composition root built, runs the module's wire step on it, and records the origin as root.

      Parameters

      • instance: T

        the instance the root built

      Returns void

      Error when an instance is already installed or a default was already built

    • Reports how the instance came to be.

      Returns Origin

      root when the root installed it, default when it was built by default, none when neither has happened

    • Records, process-wide, that a composition root is loading this process, so buildNowUnlessDeferred() builds nothing.

      Returns void