mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Update 28-tail.js
This commit is contained in:
parent
8f634cff75
commit
0db4ab1fed
@ -12,6 +12,8 @@ module.exports = function(RED) {
|
|||||||
this.split = new RegExp(n.split.replace(/\\r/g,'\r').replace(/\\n/g,'\n').replace(/\\t/g,'\t') || "[\r]{0,1}\n");
|
this.split = new RegExp(n.split.replace(/\\r/g,'\r').replace(/\\n/g,'\n').replace(/\\t/g,'\t') || "[\r]{0,1}\n");
|
||||||
var node = this;
|
var node = this;
|
||||||
|
|
||||||
|
node.tout = null;
|
||||||
|
|
||||||
var fileTail = function() {
|
var fileTail = function() {
|
||||||
if (fs.existsSync(node.filename)) {
|
if (fs.existsSync(node.filename)) {
|
||||||
if (node.filetype === "text") {
|
if (node.filetype === "text") {
|
||||||
@ -54,14 +56,14 @@ module.exports = function(RED) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var cancelRestart = function() {
|
var cancelRestart = function() {
|
||||||
if (node.tout) {
|
if (isRestartPending()) {
|
||||||
clearTimeout(node.tout);
|
clearTimeout(node.tout);
|
||||||
node.tout = null;
|
node.tout = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var isRestartPending = function() {
|
var isRestartPending = function() {
|
||||||
return !!node.tout;
|
return node.tout !== null;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (node.filename !== "") {
|
if (node.filename !== "") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user