@osaedasia/oresume
Version:
A user-friendly library for generating complete Single Page Applications (SPAs)
24 lines (23 loc) • 989 B
TypeScript
import { ProgressMessage } from "../../../infrastructure/task/messages/ProgressMessage";
/**
* Manages asynchronous tasks with input, output, and progress tracking capabilities.
* @template TInput Type of data used as input for task execution.
* @template TOutput Type of data produced as output from task execution.
*/
export interface ITaskService<TInput, TOutput> {
/**
* Executes an asynchronous task with the provided input data.
* @param {TInput} data Input data for task execution.
* @returns {Promise<TOutput>} A promise resolving to the task result.
*/
execute(data: TInput): Promise<TOutput>;
/**
* Terminates the currently executing task.
*/
terminate(): void;
/**
* Registers a callback for receiving progress updates during task execution.
* @param {(data: ProgressMessage) => void} callback Function called when progress updates occur.
*/
onProgress(callback: (data: ProgressMessage) => void): void;
}