Interface Valve

Valve allows to explicitly close the flow of data poured from faucet to particular sink.

Valve created by withValve faucet. Once created it can be used either immediately or somewhere downstream.

Current valve is available via whenClosed function in synchronous part of withValve sink.

Hierarchy

  • Valve

Methods

  • Closes the valve, either normally or abruptly.

    This would signal the faucet to stop pouring the data. The data processing of data sank previously not necessarily terminated.

    When reason specified, the valve is closed abruptly. This causes any attempt to sink more data to throw a ValveClosedError instead of silently ignoring it.

    Calling this method again has no effect.

    Parameters

    • Optional reason: unknown

      A reason to close the valve. When specified and not undefined, the valve is closed abruptly.

    Returns void

  • Calls the given callback function when the valve closed.

    If the valve is closed already, then calls the callback immediately.

    Parameters

    • callback: ValveCallback

      Function to call once this valve is closed.

    Returns void

  • Pours this valve to the given sink.

    If there is a current valve, then makes this one depend on it. I.e. once that valve is closed, this one would be closed with the same reason.

    Make the valve current for the synchronous part of the sink.

    Parameters

    Returns Promise<void>

    Promise resolved when valve sank.

Generated using TypeDoc