t-hooks
    Preparing search index...

    Function useGeneratorCallbackState

    • Generator-based asynchronous callback hook

      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 readonly [(...args: A) => Task<R>, boolean, () => void]

      callback to be invoked, current execution status (running or not) and cancellation function

      useTaskCallbackState

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