Type alias Faucet<T, TArgs>

Faucet<out T, in TArgs>: ((this, ...args) => Promise<void>)

Type Parameters

  • out T

    Poured data type.

  • in TArgs extends unknown[] = []

    Type of faucet arguments.

Type declaration

    • (this, ...args): Promise<void>
    • Faucet is a function that generates data and pours it to sink. Once the data value sank it may be invalidated. Generally, it is illegal to use the data values outside the target sink.

      Faucet may pour the data many times. Data values may be poured either sequentially or in parallel to each other.

      The promise returned from the faucet resolves once all poured data processed (sank) by target sink.

      Data pouring can be stopped explicitly by closing the valve.

      Faucet can be created with createFaucet function. It handles the valve closing. It also ensures that the returned promise resolves only when all data sank.

      Parameters

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

        Faucet arguments followed by target sink.

      Returns Promise<void>

      Promise resolved when all data poured and sank.

Generated using TypeDoc