UNPKG

2.1 kBTypeScriptView Raw
1import { CronTime } from './time';
2import { CronCallback, CronContext, CronJobParams, CronOnCompleteCallback, CronOnCompleteCommand, WithOnComplete } from './types/cron.types';
3export declare class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
4 cronTime: CronTime;
5 running: boolean;
6 unrefTimeout: boolean;
7 lastExecution: Date | null;
8 runOnce: boolean;
9 context: CronContext<C>;
10 onComplete?: WithOnComplete<OC> extends true ? CronOnCompleteCallback : undefined;
11 waitForCompletion: boolean;
12 private _isCallbackRunning;
13 private _timeout?;
14 private _callbacks;
15 get isCallbackRunning(): boolean;
16 constructor(cronTime: CronJobParams<OC, C>['cronTime'], onTick: CronJobParams<OC, C>['onTick'], onComplete?: CronJobParams<OC, C>['onComplete'], start?: CronJobParams<OC, C>['start'], timeZone?: CronJobParams<OC, C>['timeZone'], context?: CronJobParams<OC, C>['context'], runOnInit?: CronJobParams<OC, C>['runOnInit'], utcOffset?: null, unrefTimeout?: CronJobParams<OC, C>['unrefTimeout'], waitForCompletion?: CronJobParams<OC, C>['waitForCompletion']);
17 constructor(cronTime: CronJobParams<OC, C>['cronTime'], onTick: CronJobParams<OC, C>['onTick'], onComplete?: CronJobParams<OC, C>['onComplete'], start?: CronJobParams<OC, C>['start'], timeZone?: null, context?: CronJobParams<OC, C>['context'], runOnInit?: CronJobParams<OC, C>['runOnInit'], utcOffset?: CronJobParams<OC, C>['utcOffset'], unrefTimeout?: CronJobParams<OC, C>['unrefTimeout'], waitForCompletion?: CronJobParams<OC, C>['waitForCompletion']);
18 static from<OC extends CronOnCompleteCommand | null = null, C = null>(params: CronJobParams<OC, C>): CronJob<OC, C>;
19 private _fnWrap;
20 addCallback(callback: CronCallback<C, WithOnComplete<OC>>): void;
21 setTime(time: CronTime): void;
22 nextDate(): import("luxon").DateTime<boolean>;
23 fireOnTick(): Promise<void>;
24 nextDates(i?: number): import("luxon").DateTime<boolean>[];
25 start(): void;
26 lastDate(): Date | null;
27 private _executeOnComplete;
28 private _waitForJobCompletion;
29 stop(): void;
30}