fix(core): update

This commit is contained in:
2022-11-21 09:14:32 +01:00
parent d3dd03534a
commit b2a5cda468
23 changed files with 4426 additions and 27030 deletions

View File

@@ -1,9 +1,11 @@
import * as plugins from './smarttime.plugins';
import { CronManager } from './smarttime.classes.cronmanager';
import * as plugins from './smarttime.plugins.js';
import { CronManager } from './smarttime.classes.cronmanager.js';
import { CronParser } from './smarttime.classes.cronparser';
import { CronParser } from './smarttime.classes.cronparser.js';
export type TJobFunction = ((triggerTimeArg?: number) => void) | ((triggerTimeArg?: number) => Promise<any>);
export type TJobFunction =
| ((triggerTimeArg?: number) => void)
| ((triggerTimeArg?: number) => Promise<any>);
export class CronJob {
public cronParser: typeof plugins.croner;
@@ -28,7 +30,7 @@ export class CronJob {
if (Date.now() > this.nextExecutionUnix) {
const maybePromise = this.jobFunction(this.nextExecutionUnix);
if (maybePromise instanceof Promise) {
maybePromise.catch(e => console.log(e));
maybePromise.catch((e) => console.log(e));
}
this.nextExecutionUnix = this.getNextExecutionTime();
}
@@ -36,7 +38,7 @@ export class CronJob {
}
public getNextExecutionTime() {
return this.nextExecutionUnix = Date.now() + this.getTimeToNextExecution();
return (this.nextExecutionUnix = Date.now() + this.getTimeToNextExecution());
}
/**