UNPKG

edge-master

Version:
21 lines (20 loc) 701 B
/// <reference types="@cloudflare/workers-types" /> import { TaskConstructArgs, Condition, TaskDuty, TaskContext } from './types/task'; /** * Task is a class for defining and executing tasks with optional conditions. */ export declare class Task { when?: Condition; do: TaskDuty; doThen?: TaskDuty; /** * Creates a new task with the specified actions and conditions. * @param args The arguments to construct the task. */ constructor(args: TaskConstructArgs); /** * Executes the task with the given context and returns a response. * @param taskCtx The task context with required properties. */ run(taskCtx: TaskContext): Promise<Response>; }