Move Inject node to CronosJS module

This commit is contained in:
Nick O'Leary 2021-04-26 14:47:50 +01:00
parent b62e4f6662
commit ea50ba16f9
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@
"cookie": "0.4.1", "cookie": "0.4.1",
"cookie-parser": "1.4.5", "cookie-parser": "1.4.5",
"cors": "2.8.5", "cors": "2.8.5",
"cron": "1.7.2", "cronosjs": "1.7.1",
"denque": "1.5.0", "denque": "1.5.0",
"express": "4.17.1", "express": "4.17.1",
"express-session": "1.17.1", "express-session": "1.17.1",

View File

@ -16,7 +16,7 @@
module.exports = function(RED) { module.exports = function(RED) {
"use strict"; "use strict";
var cron = require("cron"); const {scheduleTask} = require("cronosjs");
function InjectNode(n) { function InjectNode(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
@ -85,7 +85,7 @@ module.exports = function(RED) {
if (RED.settings.verbose) { if (RED.settings.verbose) {
this.log(RED._("inject.crontab", this)); this.log(RED._("inject.crontab", this));
} }
this.cronjob = new cron.CronJob(this.crontab, function() { node.emit("input", {}); }, null, true); this.cronjob = scheduleTask(this.crontab,() => { node.emit("input", {})});
} }
}; };

View File

@ -22,7 +22,7 @@
"cookie-parser": "1.4.5", "cookie-parser": "1.4.5",
"cookie": "0.4.1", "cookie": "0.4.1",
"cors": "2.8.5", "cors": "2.8.5",
"cron": "1.7.2", "cronosjs": "1.7.1",
"denque": "1.5.0", "denque": "1.5.0",
"fs-extra": "9.1.0", "fs-extra": "9.1.0",
"fs.notify": "0.0.4", "fs.notify": "0.0.4",