Class AcCmTaskScheduler<TInitial, TFinal>

Type-safe task scheduler that executes a chain of named tasks in order.

The scheduler passes results between tasks, reports progress, and stops execution on the first failure. Supports both synchronous and asynchronous tasks.

// Create scheduler with string input and object output
const scheduler = new AcCmTaskScheduler<string, ParsedData>()

// Add tasks
scheduler.addTask(new LoadFileTask())
scheduler.addTask(new ParseDataTask())
scheduler.addTask(new ValidateDataTask())

// Set callbacks
scheduler.setProgressCallback((progress, task) => {
console.log(`${task.name}: ${(progress * 100).toFixed(1)}%`)
})

scheduler.setCompleteCallback((result) => {
console.log('All tasks completed:', result)
})

// Execute
await scheduler.execute('file.dwg')

Type Parameters

  • TInitial

    Initial input type for the first task.

  • TFinal = TInitial

    Final output type from the last task.

Constructors

Methods