Context module setup.

Passed to module setup method in order to access and provide the necessary values.

Type Param

Target context type.

Hierarchy

  • CxValues
  • CxModifier
  • SupplyPeer
    • Setup

Properties

Methods

Properties

context: CxValues

Modified context.

module: CxModule

The module to set up.

supply: Supply

Module supply.

This supply will be cut off once the module is unloaded.

Methods

  • Obtains value of the given context entry.

    Type Parameters

    • TValue

      Requested context value type.

    Parameters

    • entry: CxEntry<TValue, unknown>

      Context entry to obtain the value of.

    • Optional request: WithoutFallback<TValue>

      Context value request with fallback specified.

    Returns TValue

    Either context entry value, or a fallback one.

  • Obtains value of the given context entry, or returns a non-nullable fallback.

    Type Parameters

    • TValue

      Requested context value type.

    Parameters

    • entry: CxEntry<TValue, unknown>

      Context entry to obtain the value of.

    • request: WithFallback<TValue>

      Context value request with fallback specified.

    Returns TValue

    Either context entry value, or a fallback one.

  • Obtains value of the given context entry, or returns a nullable fallback.

    Throws

    CxReferenceError - If the target entry has no value and fallback one is not provided.

    Type Parameters

    • TValue

      Requested context value type.

    Parameters

    • entry: CxEntry<TValue, unknown>

      Context entry to obtain the value of.

    • Optional request: CxRequest<TValue>

      Context value request.

    Returns null | TValue

    Either context entry value, or a fallback one.

  • Registers the module initializer.

    The module initializer registration is only valid during its setup.

    The registered initializers executed after successful module setup. The modules is considered ready for use only when all registered initializers succeed.

    The registered initializers executed serially. I.e. then next one does not start until the previous one succeeds.

    It is an error calling this method when the module initialized already.

    Parameters

    • init: ((this) => void | PromiseLike<unknown>)

      The module initialization function, that returns nothing when the module initialization completed synchronously, or a promise-like instance resolved when the module initialization completed asynchronously.

        • (this): void | PromiseLike<unknown>
        • Parameters

          • this: void

          Returns void | PromiseLike<unknown>

    Returns void

  • Provides assets for context CxAsset.entry entry.

    All assets provided by this method will be revoked once the module unloaded.

    Type Parameters

    • TValue

    • TAsset = TValue

    Parameters

    • asset: CxAsset<TValue, TAsset>

      Context entry asset.

    Returns Supply

    Assets supply. Revokes provided assets once cut off.

Generated using TypeDoc