Uneventful
    Preparing search index...

    ActivityFn<T, This>

    ActivityFn: EventuallyReturns<T, This> | Setup<T, This>

    A function implementing a Task, or an Activity within a task

    An activity function is a function run within a task's Scope and passed its Work. Either the function:

    1. Does the work itself (e.g. as a generator function returning a Coroutine, or an async function returning a Promise),

    2. Delegates it to a returned Eventual value, or

    3. Synchronously sets up the activity (by wiring listeners, signals, etc.), to eventually call work.return() or work.throw() to finish the task. (If applicable, that is! Some tasks or activities are simply meant to run until canceled.) A synchronous Setup function can also return an optional cleanup function, in lieu of passing it to must().

    Type Parameters

    • T

      The type of result the function produces; use never for an activity that keeps running until canceled and won't ever call work.return() either.

    • This = void

      The type of this the function accepts, if using the deprecated two-argument start() form, or boundTo().

    When you create an activity function that takes an explicit work or self argument (to receive the work context), you need to either explicitly type it (e.g. function*(self: Work<number>){}) or provide a type parameter to the thing you're calling it with (e.g. start<number>(function*(self){...})), or you'll end up with a Work<unknown>, which is probably not what you want.