Interface Drain<T, TArgs>

Drain is like a faucet that can pour data to multiple sinks.

Drain may pour data many times to multiple sinks. Data values may be poured either sequentially or in parallel to each other.

To start pouring the data, open the drain by calling it with arguments. To pour the data to another sink - call it again downstream without arguments.

Data pouring to particular sink can be stopped explicitly by closing corresponding valve.

Drains created by createDrain function.

Type Parameters

  • out T

    Poured data type.

  • in TArgs extends unknown[] = []

    Type of drain arguments.

Hierarchy

  • Drain
  • Opens the drain and starts data pouring.

    Parameters

    • this: void
    • Rest ...args: [...TArgs[], Sink<T>]

      Drain arguments followed by target sink.

    Returns Promise<void>

    Promise resolved when all data poured and sank.

  • Pours the data from previously opened drain to another sink.

    If the drain is not yet opened yet, may either open it with default arguments, or reject the sink.

    Parameters

    • this: void
    • sink: Sink<T>

      Target sink.

    Returns Promise<void>

    Promise resolved when all data poured and sank.

Generated using TypeDoc