Function withInflow

  • Starts inflow of drains.

    Each drain opened within synchronous part of the given sink can pour data again downstream. For that, call the drain without arguments within poured faucet's sink.

    Parameters

    • sink: Sink<Faucet<void>>

      The sink of no-args faucet that reproduces the inflow downstream.

    Returns Promise<void>

    Promise resolved when all data poured and sank.

    Example

    await withInflow(async withDrainInflow => {
    await withDrain(async initialValue => {
    // Sink the value poured by just opened drain.
    // ...some asynchronous code...
    await withDrainInflow(async () => {
    await withDrain(async nextValue => {
    // Sink the value from previously opened drain.
    });
    });
    });
    });

    Inflows could be nested within each other. The nested inflow inherits all drains opened in enclosing one. It may override any of them, as well as open new ones.

  • Starts named inflow of drains.

    Parameters

    • name: string

      Name of inflow used for debug.

    • sink: Sink<Faucet<void>>

      The sink of no-args faucet that reproduces the inflow downstream.

    Returns Promise<void>

    Promise resolved when all data poured and sank.

Generated using TypeDoc