Interface Builder<TValue, TAsset, TContext>

Context entry asset builder.

Builds a provider of assets for the value of specific context entry.

Type Parameters

  • TValue

    Context value type.

  • TAsset = TValue

    Context value asset type.

  • TContext extends CxValues = CxValues

    Context type.

Hierarchy

  • Base<TValue, TAsset, TContext>
    • Builder

Properties

entry: CxEntry<TValue, TAsset>

Target context entry.

placeAsset?: undefined

Ignored when buildAsset defined.

supply?: Supply

Asset supply.

Removes the asset once cut off.

Returned from provide when specified. New one created when omitted.

Methods

  • Builds value asset provider. The provider would then place value assets to the target context entry.

    In contrast to placeAsset, this method is called at most once per context. If provider will be called each time value assets requested.

    This method also supports updatable assets. For that, an update function is passed as second parameter. Call it to inform the interested parties on value asset update. The updated asset has to be provided by provider returned earlier.

    Parameters

    • target: Target<TValue, TAsset, TContext>

      Context entry definition target.

    • update: ((this) => void)

      A function to call when asset updated.

        • (this): void
        • Parameters

          • this: void

          Returns void

    Returns undefined | null | false | ((this, collector) => void)

    Value assets provider accepting assets collector to place assets to as its only parameter, or falsy value if there are no value assets.

  • Sets up asset.

    This method is called immediately when asset provided.

    It can be used e.g. to provide additional assets. Additional assets will be revoked when the asset itself revoked.

    Parameters

    • target: Target<TValue, TAsset, TContext>

      Context entry definition target.

    Returns void

Generated using TypeDoc