method IScheduler.cron
IScheduler.cron<T = unknown>(
name: string,
expression: string,
handler: SchedulerJobHandler<T>,
options?: ScheduleOptions<T>
): Promise<void>

Schedule a recurring job using a 5-field cron expression (UTC).

Type Parameters

T = unknown

Parameters

name: string

Unique job name

expression: string

5-field cron expression

Callback to invoke on each fire

optional
options: ScheduleOptions<T>

Optional payload and retry config

Return Type

Promise<void>

Throws

Error

If a job with name is already scheduled

Usage

import { type IScheduler } from "common/src/index.ts";