@pushrocks/smarttime
Advanced tools
Comparing version 3.0.21 to 3.0.22
@@ -6,5 +6,6 @@ import * as plugins from './smarttime.plugins'; | ||
status: 'started' | 'stopped'; | ||
cronjobs: CronJob[]; | ||
cronjobs: plugins.lik.ObjectMap<CronJob>; | ||
constructor(); | ||
addCronjob(cronIdentifierArg: string, cronFunctionArg: () => any): CronJob; | ||
removeCronjob(cronjobArg: CronJob): void; | ||
/** | ||
@@ -11,0 +12,0 @@ * starts the cronjob |
@@ -28,7 +28,7 @@ "use strict"; | ||
this.status = 'stopped'; | ||
this.cronjobs = []; | ||
this.cronjobs = new plugins.lik.ObjectMap(); | ||
} | ||
addCronjob(cronIdentifierArg, cronFunctionArg) { | ||
const newCronJob = new smarttime_classes_cronjob_1.CronJob(this, cronIdentifierArg, cronFunctionArg); | ||
this.cronjobs.push(newCronJob); | ||
this.cronjobs.add(newCronJob); | ||
if (this.status === 'started') { | ||
@@ -39,2 +39,6 @@ newCronJob.start(); | ||
} | ||
removeCronjob(cronjobArg) { | ||
cronjobArg.stop(); | ||
this.cronjobs.remove(cronjobArg); | ||
} | ||
/** | ||
@@ -45,3 +49,3 @@ * starts the cronjob | ||
this.status = 'started'; | ||
for (const cronJob of this.cronjobs) { | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
cronJob.start(); | ||
@@ -55,3 +59,3 @@ } | ||
let timeToNextOverallExecution; | ||
for (const cronJob of this.cronjobs) { | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
const timeToNextJobExecution = cronJob.checkExecution(); | ||
@@ -74,3 +78,3 @@ if (timeToNextJobExecution < timeToNextOverallExecution || !timeToNextOverallExecution) { | ||
this.executionTimeout.cancel(); | ||
for (const cron of this.cronjobs) { | ||
for (const cron of this.cronjobs.getArray()) { | ||
cron.stop(); | ||
@@ -81,2 +85,2 @@ } | ||
exports.CronManager = CronManager; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLmNsYXNz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QUFDO1FBQy9CLEtBQUssTUFBTSxJQUFJLElBQUksSUFBSSxDQUFDLFFBQVEsQ0FBQyxRQUFRLEVBQUUsRUFBRTtZQUMzQyxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUM7U0FDYjtJQUNILENBQUM7Q0FDRjtBQTlERCxrQ0E4REMifQ== |
@@ -0,6 +1,7 @@ | ||
import * as lik from '@pushrocks/lik'; | ||
import * as smartdelay from '@pushrocks/smartdelay'; | ||
import * as smartpromise from '@pushrocks/smartpromise'; | ||
export { smartdelay, smartpromise }; | ||
export { lik, smartdelay, smartpromise }; | ||
import croner from 'croner'; | ||
import dayjs from 'dayjs'; | ||
export { croner, dayjs }; |
@@ -25,4 +25,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dayjs = exports.croner = exports.smartpromise = exports.smartdelay = void 0; | ||
exports.dayjs = exports.croner = exports.smartpromise = exports.smartdelay = exports.lik = void 0; | ||
// @pushrocks scope | ||
const lik = __importStar(require("@pushrocks/lik")); | ||
exports.lik = lik; | ||
const smartdelay = __importStar(require("@pushrocks/smartdelay")); | ||
@@ -37,2 +39,2 @@ exports.smartdelay = smartdelay; | ||
exports.dayjs = dayjs_1.default; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsbUJBQW1CO0FBQ25CLGtFQUFvRDtBQUczQyxnQ0FBVTtBQUZuQixzRUFBd0Q7QUFFbkMsb0NBQVk7QUFFakMsZ0JBQWdCO0FBQ2hCLG9EQUE0QjtBQUduQixpQkFIRixnQkFBTSxDQUdFO0FBRmYsa0RBQTBCO0FBRVQsZ0JBRlYsZUFBSyxDQUVVIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR0aW1lLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHRpbWUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsbUJBQW1CO0FBQ25CLG9EQUFzQztBQUk3QixrQkFBRztBQUhaLGtFQUFvRDtBQUd0QyxnQ0FBVTtBQUZ4QixzRUFBd0Q7QUFFOUIsb0NBQVk7QUFFdEMsZ0JBQWdCO0FBQ2hCLG9EQUE0QjtBQUduQixpQkFIRixnQkFBTSxDQUdFO0FBRmYsa0RBQTBCO0FBRVQsZ0JBRlYsZUFBSyxDQUVVIn0= |
{ | ||
"name": "@pushrocks/smarttime", | ||
"private": false, | ||
"version": "3.0.21", | ||
"version": "3.0.22", | ||
"description": "handle time in smart ways", | ||
@@ -25,2 +25,3 @@ "main": "dist_ts/index.js", | ||
"dependencies": { | ||
"@pushrocks/lik": "^4.0.13", | ||
"@pushrocks/smartdelay": "^2.0.10", | ||
@@ -27,0 +28,0 @@ "@pushrocks/smartpromise": "^3.0.2", |
@@ -8,3 +8,3 @@ import * as plugins from './smarttime.plugins'; | ||
public status: 'started' | 'stopped' = 'stopped'; | ||
public cronjobs: CronJob[] = []; | ||
public cronjobs = new plugins.lik.ObjectMap<CronJob>(); | ||
@@ -15,3 +15,3 @@ constructor() {} | ||
const newCronJob = new CronJob(this, cronIdentifierArg, cronFunctionArg); | ||
this.cronjobs.push(newCronJob); | ||
this.cronjobs.add(newCronJob); | ||
if (this.status === 'started') { | ||
@@ -24,2 +24,7 @@ newCronJob.start(); | ||
public removeCronjob(cronjobArg: CronJob) { | ||
cronjobArg.stop(); | ||
this.cronjobs.remove(cronjobArg); | ||
} | ||
/** | ||
@@ -30,3 +35,3 @@ * starts the cronjob | ||
this.status = 'started'; | ||
for (const cronJob of this.cronjobs) { | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
cronJob.start(); | ||
@@ -41,3 +46,3 @@ } | ||
let timeToNextOverallExecution: number; | ||
for (const cronJob of this.cronjobs) { | ||
for (const cronJob of this.cronjobs.getArray()) { | ||
const timeToNextJobExecution = cronJob.checkExecution(); | ||
@@ -62,3 +67,3 @@ if (timeToNextJobExecution < timeToNextOverallExecution || !timeToNextOverallExecution) { | ||
this.executionTimeout.cancel(); | ||
for (const cron of this.cronjobs) { | ||
for (const cron of this.cronjobs.getArray()) { | ||
cron.stop(); | ||
@@ -65,0 +70,0 @@ } |
// @pushrocks scope | ||
import * as lik from '@pushrocks/lik'; | ||
import * as smartdelay from '@pushrocks/smartdelay'; | ||
import * as smartpromise from '@pushrocks/smartpromise'; | ||
export { smartdelay, smartpromise }; | ||
export { lik, smartdelay, smartpromise }; | ||
@@ -7,0 +8,0 @@ // third parties |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1476458
12960
6
1
+ Added@pushrocks/lik@^4.0.13
+ Added@pushrocks/lik@4.0.225.0.7(transitive)
+ Added@pushrocks/smartmatch@1.0.7(transitive)
+ Added@pushrocks/smartrx@2.0.27(transitive)
+ Added@pushrocks/smarttime@3.0.50(transitive)
+ Added@types/minimatch@3.0.5(transitive)
+ Addedcroner@4.4.1(transitive)
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedmatcher@3.0.0(transitive)
+ Addedparse-ms@2.1.0(transitive)
+ Addedpretty-ms@7.0.1(transitive)
+ Addedrxjs@7.8.1(transitive)
+ Addedsymbol-tree@3.2.4(transitive)
+ Addedtslib@2.8.1(transitive)