Documentation
    Preparing search index...

    Class Flow<GIn, GOut, GReturn, GArguments>

    A flow is a wrapper around an AsyncGenerator factory.

    When opening a Flow, the provided factory is called with a FlowContext and returns a new AsyncGenerator. The FlowContext exposes functions to read the values sent through iterator.next(value) and iterator.return(value). Moreover, it receives an AbortSignal that must be used to abort a pending iteration of the flow.

    Type Parameters

    • GIn
    • GOut
    • GReturn
    • GArguments extends readonly unknown[]

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Opens this Flow: it calls the provided factory function with a corresponding FlowContext.

      The provided signal is used to abort the current pending iteration.

      Parameters

      • signal: AbortSignal

        The AbortSignal that must be used to abort the current pending iteration.

      • ...args: GArguments

        The arguments to pass to the factory function.

      Returns AsyncEnumeratorObject<GIn, GOut, GReturn>

      An AsyncEnumeratorObject that will be used to iterate over the flow.