Type alias AsyncStart<T, This>

AsyncStart<T, This>: ((this: This, job: Job<T>) => StartObj<T>)

An asynchronous start function is called immediately in the new job and must return a StartObj, such as a job, generator, or promise. If a job or promise is returned, it will be awaited and its result used to asynchronously set the result of the returned job.

If a generator is returned, it will be run asynchronously, in the context of the newly-started job. Any result it returns or error it throws will be treated as the result of the job. If the job is canceled, the iterator's .return() method will be called to abort it (thereby running any try-finally clauses in the generator), and the result of the call will be otherwise ignored.

Type Parameters

  • T

    The type the job will end up returning

  • This = void

    The type of this the function accepts, if using two-argument start(). Defaults to void (for one-argument start()).

Type declaration