Function useGeneratorCallback

  • Generator-based asynchronous callback hook (convinience binding)

    Generator version of task-callback converting generator to compound task first

    Task execution is automatically interrupted in case of additional calls or unmounting. This way, only one task is running at the given time

    Type Parameters

    • A extends any[]

      callback arguments type

    • T

    • TT extends Task<T>

      yielded task type

    • R

      resulting task resolve type

    Parameters

    • taskGeneratorFunction: TaskGeneratorFunction<A, T, TT, R>

      task generator function

    • deps: DependencyList

      dependency list

    Returns ((...args) => Task<R>)

    callback to be invoked

      • (...args): Task<R>
      • Parameters

        • Rest ...args: A

        Returns Task<R>

    See

    useTaskCallbackState

    Note

    Task is not cancelled on hook re-render, but is cancelled on the next call instead

Generated using TypeDoc