Interface SupplyReceiver<TResult>

Supply receiver is informed when supply cut off.

When registered in supplier, the latter calls the cutOff method once cut off, unless the receiver is not available anymore.

Supply receivers may be used as a passive alternative to removeEventListener approach. While the latter can be used to remove the listener in order to stop receiving events, the supply receiver may set itself unavailable, so that the supplier would be able to remove it occasionally.

Note that any Supply may act as a supply receiver.

Type Parameters

  • out TResult = void

    Supply result type.

Hierarchy

  • SupplyReceiver

Constructors

Properties

Methods

Constructors

constructor

Properties

isOff: null | SupplyIsOff<TResult>

Indicates whether this receiver is unavailable.

It is expected that once this indicator set , it would never be reset.

The supply would never call the cutOff method of this receiver, once this indicator set.

The receiver with this indicator set will be ignored by supplier when trying register it. Moreover, if this indicator set after the registration, the supplier may wish to remove it at any time.

Methods

  • Called by the source supply when the latter cut off.

    This method is called at least once, unless the receiver is unavailable, in which case this method would never be called.

    It is reasonable to set this property to no-op once the receiver becomes unavailable. This would release the resources held by it, and help Garbage Collector to free them.

    Parameters

    • reason: SupplyIsOff<TResult>

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

    Returns void

Generated using TypeDoc