UNPKG

express-post-task-scheduler

Version:

A lightweight npm package to create and manage scheduled tasks using Express middleware. Configure tasks via POST requests and execute them at specified times seamlessly.

9 lines (8 loc) 512 B
import { ITaskDataItem } from "./@types/task"; /** * Schedule a task and wait for executing, return the job * @param date the date time to start task * @param data array with the params for task, for example: [{ id:1, value:1 }, { id:2, value:2 }, { id:3, value:3 }] * @param executor the callback function to execute, for example: (index: number) => { console.log(index) } */ export declare function scheduleTask(date: Date, data: ITaskDataItem[], executor: (...args: any[]) => any, taskId: number): void;