mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
add checks for interval value
This commit is contained in:
parent
8750c4b121
commit
ee13cd10fe
@ -213,13 +213,20 @@ module.exports = function(RED) {
|
|||||||
send_interval(node, allow_empty_seq);
|
send_interval(node, allow_empty_seq);
|
||||||
node.pending_count = 0;
|
node.pending_count = 0;
|
||||||
}
|
}
|
||||||
var timer = setInterval(msgHandler, interval);
|
var timer = undefined;
|
||||||
|
if (interval > 0) {
|
||||||
|
timer = setInterval(msgHandler, interval);
|
||||||
|
}
|
||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
if (msg.hasOwnProperty("reset")) {
|
if (msg.hasOwnProperty("reset")) {
|
||||||
clearInterval(timer);
|
if (timer !== undefined) {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
node.pending = [];
|
node.pending = [];
|
||||||
node.pending_count = 0;
|
node.pending_count = 0;
|
||||||
timer = setInterval(msgHandler, interval);
|
if (interval > 0) {
|
||||||
|
timer = setInterval(msgHandler, interval);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node.pending.push(msg);
|
node.pending.push(msg);
|
||||||
@ -232,7 +239,9 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.on("close", function() {
|
this.on("close", function() {
|
||||||
clearInterval(timer);
|
if (timer !== undefined) {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
node.pending = [];
|
node.pending = [];
|
||||||
node.pending_count = 0;
|
node.pending_count = 0;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user