Interface SupplyIn<TResult>

Receiving side of supply.

It is informed on supply cut off.

Type Parameters

  • in out TResult = void

    Supply result type.

Hierarchy

Accessors

  • get isOff(): null | SupplyIsOff<TResult>
  • Indicates whether this supply is cut off already.

    null initially. Set once supply cut off. Once set, nothing will be supplied anymore.

    Returns null | SupplyIsOff<TResult>

Methods

  • Cuts off this supply.

    When called for the first time, all registered supply receivers informed with the given reason, and isOff property value becomes equal to it. Calling this method for the second time has no effect.

    After this method call nothing would be supplied anymore.

    Parameters

    • reason: SupplyIsOff<TResult>

      A reason indicating why the supply has been cut off, and when.

    Returns SupplyIn<TResult>

    this instance.

  • Completes this supply successfully with the given result.

    Calling this method is the same as calling this.cutOff(SupplyIsOff.successfully(result)).

    Parameters

    • result: TResult

      Supply result.

    Returns SupplyIn<TResult>

    this instance.

  • Terminates this supply faultily.

    Calling this method is the same as calling this.cutOff(SupplyIsOff.faultily(reason)).

    Parameters

    • reason: unknown

      Supply failure reason.

    Returns SupplyIn<TResult>

    this instance.

  • Makes this supply depend on another supplier.

    Once the supplier cuts off the supply, this supply will be cut off with the same reason.

    Calling this method has the same effect as calling supplier.alsoOff(this).

    Parameters

    • supplier: Supplier<TResult>

      A supplier to make this supply depend on.

    Returns SupplyIn<TResult>

    this instance.

  • Cuts off this supply with arbitrary reason.

    Calling this method is the same as calling this.cutOff(SupplyIsOff.becauseOf(reason)).

    Type Parameters

    • TReason

    Parameters

    • Rest ...reason: ReasonArgs<TResult, TReason>

      An optional reason why the supply is cut off. This reason converted to supply cut off indicator. By convenience, undefined or missing reason means successful supply completion.

    Returns SupplyIn<TResult>

    this instance.

  • Creates required supply this one depends on.

    Parameters

    • Optional required: undefined

    Returns Supply<TResult>

    New required supply instance.

  • Makes this supplier depend on another supplier.

    In contrast to needs method, this one returns required supplier.

    Type Parameters

    • TSupplier extends Supplier<TResult, TSupplier>

      Type of required supplier.

    Parameters

    • required: TSupplier

      Supplier to make this supply depend on.

    Returns TSupplier

    Required supplier.

  • Creates required supply this one depends on.

    If required supplier specified, makes this supply depend on it.

    In contrast to needs method, this one returns required supplier.

    Type Parameters

    • TSupplier extends Supplier<TResult, TSupplier>

      Type of required supplier.

    Parameters

    • required: undefined | TSupplier

      Optional supplier to make this supply depend on.

    Returns Supply<TResult> | TSupplier

    Required supplier.

Generated using TypeDoc