mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add status icon to trigger node while it is active
This commit is contained in:
parent
ad44f838da
commit
30e3525987
@ -74,6 +74,7 @@
|
|||||||
never will, and neither can the first be retriggered - so a true one shot.</p>
|
never will, and neither can the first be retriggered - so a true one shot.</p>
|
||||||
<p>If a <b>msg.reset</b> property is present any timeout currently in progress
|
<p>If a <b>msg.reset</b> property is present any timeout currently in progress
|
||||||
will be cleared and the second output will not happen.</p>
|
will be cleared and the second output will not happen.</p>
|
||||||
|
<p>The blue status icon will be visible while the node is active.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -54,6 +54,7 @@ module.exports = function(RED) {
|
|||||||
if (msg.hasOwnProperty("reset")) {
|
if (msg.hasOwnProperty("reset")) {
|
||||||
clearTimeout(tout);
|
clearTimeout(tout);
|
||||||
tout = null;
|
tout = null;
|
||||||
|
node.status({});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!tout) {
|
if (!tout) {
|
||||||
@ -70,8 +71,10 @@ module.exports = function(RED) {
|
|||||||
msg.payload = m2;
|
msg.payload = m2;
|
||||||
if (node.op2type !== "nul") { node.send(msg); }
|
if (node.op2type !== "nul") { node.send(msg); }
|
||||||
tout = null;
|
tout = null;
|
||||||
|
node.status({});
|
||||||
},node.duration);
|
},node.duration);
|
||||||
}
|
}
|
||||||
|
node.status({fill:"blue",shape:"dot",text:" "});
|
||||||
}
|
}
|
||||||
else if ((node.extend === "true" || node.extend === true) && (node.duration > 0)) {
|
else if ((node.extend === "true" || node.extend === true) && (node.duration > 0)) {
|
||||||
clearTimeout(tout);
|
clearTimeout(tout);
|
||||||
@ -79,12 +82,16 @@ module.exports = function(RED) {
|
|||||||
msg.payload = m2;
|
msg.payload = m2;
|
||||||
if (node.op2type !== "nul") { node.send(msg); }
|
if (node.op2type !== "nul") { node.send(msg); }
|
||||||
tout = null;
|
tout = null;
|
||||||
|
node.status({});
|
||||||
},node.duration);
|
},node.duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.on("close", function() {
|
this.on("close", function() {
|
||||||
if (tout) { clearTimeout(tout); }
|
if (tout) {
|
||||||
|
clearTimeout(tout);
|
||||||
|
node.status({});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
RED.nodes.registerType("trigger",TriggerNode);
|
RED.nodes.registerType("trigger",TriggerNode);
|
||||||
|
Loading…
Reference in New Issue
Block a user