fix(core): update
This commit is contained in:
parent
88378e2f31
commit
b5ab945501
@ -25,6 +25,7 @@
|
|||||||
"@pushrocks/lik": "^4.0.17",
|
"@pushrocks/lik": "^4.0.17",
|
||||||
"@pushrocks/smartdelay": "^2.0.10",
|
"@pushrocks/smartdelay": "^2.0.10",
|
||||||
"@pushrocks/smartpromise": "^3.0.2",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
|
"croner": "^1.1.23",
|
||||||
"dayjs": "^1.8.35",
|
"dayjs": "^1.8.35",
|
||||||
"is-nan": "^1.3.0"
|
"is-nan": "^1.3.0"
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,7 @@ import { CronParser } from './smarttime.classes.cronparser';
|
|||||||
export type TJobFunction = (() => void) | (() => Promise<any>);
|
export type TJobFunction = (() => void) | (() => Promise<any>);
|
||||||
|
|
||||||
export class CronJob {
|
export class CronJob {
|
||||||
public cronParser: CronParser;
|
public cronParser: CronParser | typeof plugins.croner;
|
||||||
public status: 'started' | 'stopped' | 'initial' = 'initial';
|
public status: 'started' | 'stopped' | 'initial' = 'initial';
|
||||||
public cronExpression: string;
|
public cronExpression: string;
|
||||||
public jobFunction: TJobFunction;
|
public jobFunction: TJobFunction;
|
||||||
@ -15,7 +15,7 @@ export class CronJob {
|
|||||||
constructor(cronManager: CronManager, cronExpressionArg: string, jobFunction: TJobFunction) {
|
constructor(cronManager: CronManager, cronExpressionArg: string, jobFunction: TJobFunction) {
|
||||||
this.cronExpression = cronExpressionArg;
|
this.cronExpression = cronExpressionArg;
|
||||||
this.jobFunction = jobFunction;
|
this.jobFunction = jobFunction;
|
||||||
this.cronParser = new CronParser(cronExpressionArg);
|
this.cronParser = plugins.croner(cronExpressionArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,7 +43,7 @@ export class CronJob {
|
|||||||
* gets the time to next execution
|
* gets the time to next execution
|
||||||
*/
|
*/
|
||||||
public getTimeToNextExecution() {
|
public getTimeToNextExecution() {
|
||||||
return this.cronParser.getMsToNextTimeMatch();
|
return this.cronParser.msToNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public start() {
|
public start() {
|
||||||
|
@ -33,7 +33,7 @@ export class CronParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getMsToNextTimeMatch() {
|
public msToNext() {
|
||||||
const cronArray = this.cronArray;
|
const cronArray = this.cronArray;
|
||||||
const secondExpression = cronArray[0];
|
const secondExpression = cronArray[0];
|
||||||
const minuteExpression = cronArray[1];
|
const minuteExpression = cronArray[1];
|
||||||
|
@ -6,6 +6,7 @@ import * as smartpromise from '@pushrocks/smartpromise';
|
|||||||
export { lik, smartdelay, smartpromise };
|
export { lik, smartdelay, smartpromise };
|
||||||
|
|
||||||
// third parties
|
// third parties
|
||||||
|
import croner from 'croner';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
export { dayjs };
|
export { croner, dayjs };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user