Class AcCmTask<TIn, TOut>

Represents a named unit of work with an asynchronous or synchronous execution function.

Tasks can be chained together in a scheduler to create complex workflows with proper data flow and error handling.

class LoadFileTask extends AcCmTask<string, ArrayBuffer> {
constructor() {
super('LoadFile')
}

async run(url: string): Promise<ArrayBuffer> {
const response = await fetch(url)
return response.arrayBuffer()
}
}

Type Parameters

  • TIn

    Input type for the task.

  • TOut

    Output type for the task.

Constructors

Properties

Methods

Constructors

Properties

name: string

Name of the task (for logging/debugging purposes)

Methods

  • Executes the task with the given input.

    This method must be implemented by subclasses to define the actual work performed by the task. Can return either a synchronous result or a Promise.

    Parameters

    • _input: TIn

      The input data for the task.

    Returns TOut | Promise<TOut>

    The task result, either synchronous or asynchronous.

    When the method is not implemented by a subclass.