UNPKG

1.31 kBTypeScriptView Raw
1// Type definitions for node-cron 3.0
2// Project: https://github.com/node-cron/node-cron, https://github.com/merencia/node-cron
3// Definitions by: morsic <https://github.com/maximelkin>,
4// burtek <https://github.com/burtek>,
5// Richard Honor <https://github.com/RMHonor>
6// Ata Berk YILMAZ <https://github.com/ataberkylmz>
7// Alex Seidmann <https://github.com/aseidma>
8// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
9import EventEmitter = require('events');
10
11export function schedule(cronExpression: string, func: (now: Date) => void, options?: ScheduleOptions): ScheduledTask;
12
13export function validate(cronExpression: string): boolean;
14
15export function getTasks(): ScheduledTask[];
16
17export interface ScheduledTask extends EventEmitter {
18 start: () => this;
19 stop: () => this;
20}
21
22export interface ScheduleOptions {
23 /**
24 * A boolean to set if the created task is scheduled.
25 *
26 * Defaults to `true`
27 */
28 scheduled?: boolean | undefined;
29 /**
30 * The timezone that is used for job scheduling
31 */
32 timezone?: string;
33 /**
34 * Specifies whether to recover missed executions instead of skipping them.
35 *
36 * Defaults to `false`
37 */
38 recoverMissedExecutions?: boolean;
39}