@pushrocks/smarttime
Version:
handle time in smart ways
23 lines (22 loc) • 792 B
TypeScript
import * as plugins from './smarttime.plugins.js';
import { CronManager } from './smarttime.classes.cronmanager.js';
export type TJobFunction = ((triggerTimeArg?: number) => void) | ((triggerTimeArg?: number) => Promise<any>);
export declare class CronJob {
cronParser: plugins.croner;
status: 'started' | 'stopped' | 'initial';
cronExpression: string;
jobFunction: TJobFunction;
private nextExecutionUnix;
constructor(cronManager: CronManager, cronExpressionArg: string, jobFunction: TJobFunction);
/**
* checks wether the cronjob needs to be executed
*/
checkExecution(): number;
getNextExecutionTime(): number;
/**
* gets the time to next execution
*/
getTimeToNextExecution(): number;
start(): void;
stop(): void;
}