UNPKG

edge-master

Version:
22 lines (21 loc) 796 B
/// <reference types="@cloudflare/workers-types" /> import { Task } from "./Task"; import { ContextWithReq } from "./types/base"; import { IRouteHandler } from './types/route'; /** * RouteHandler is a class for executing a series of tasks in response to a matched route. */ export declare class RouteHandler implements IRouteHandler { private taskList; constructor(initial?: Task | Task[]); /** * Registers a task to be executed when this route handler is invoked. * @param task The task to register. */ registerTask(task: Task): RouteHandler; /** * Executes the registered tasks with the given context and returns a response. * @param ctx The request context with required properties. */ execute(ctx: ContextWithReq): Promise<Response>; }