1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Stop trigger node re-using old message…

to Close #916
Thanks @jimbojw
This commit is contained in:
Dave Conway-Jones 2016-06-25 10:44:44 +01:00
parent 9ec7bb8d41
commit 78eae99bd4

View File

@ -70,8 +70,9 @@ module.exports = function(RED) {
if (node.duration === 0) { tout = 0; } if (node.duration === 0) { tout = 0; }
else { else {
tout = setTimeout(function() { tout = setTimeout(function() {
msg.payload = m2; var msg2 = RED.util.cloneMessage(msg);
if (node.op2type !== "nul") { node.send(msg); } msg2.payload = m2;
if (node.op2type !== "nul") { node.send(msg2); }
tout = null; tout = null;
node.status({}); node.status({});
},node.duration); },node.duration);
@ -82,8 +83,9 @@ module.exports = function(RED) {
clearTimeout(tout); clearTimeout(tout);
if (node.op2type === "payl") { m2 = msg.payload; } if (node.op2type === "payl") { m2 = msg.payload; }
tout = setTimeout(function() { tout = setTimeout(function() {
msg.payload = m2; var msg2 = RED.util.cloneMessage(msg);
if (node.op2type !== "nul") { node.send(msg); } msg2.payload = m2;
if (node.op2type !== "nul") { node.send(msg2); }
tout = null; tout = null;
node.status({}); node.status({});
},node.duration); },node.duration);