• Generates an async-iterable sequence by running a state-driven loop producing the sequence's elements.

    Type Parameters

    • TState

      The type of the state used in the generator loop.

    • TResult

      The type of the elements in the produced sequence.

    Parameters

    • initialState: TState

      The initial state.

    • condition: ((value, signal?) => boolean | Promise<boolean>)

      Condition to terminate generation (upon returning false).

        • (value, signal?): boolean | Promise<boolean>
        • Parameters

          • value: TState
          • Optional signal: AbortSignal

          Returns boolean | Promise<boolean>

    • iterate: ((value, signal?) => TState | Promise<TState>)

      Iteration step function.

        • (value, signal?): TState | Promise<TState>
        • Parameters

          • value: TState
          • Optional signal: AbortSignal

          Returns TState | Promise<TState>

    • resultSelector: ((value, signal?) => TResult | Promise<TResult>)

      Selector function for results produced in the sequence.

        • (value, signal?): TResult | Promise<TResult>
        • Parameters

          • value: TState
          • Optional signal: AbortSignal

          Returns TResult | Promise<TResult>

    Returns AsyncIterable<TResult>

    The generated async-iterable sequence.

Generated using TypeDoc