diff --git a/README.md b/README.md index abab811..372ff0c 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,5 @@ A node that stores a message and emits it when it is triggered. 1. Send a message to the node 2. Send a message which has the .trigger property set to true. The message sent at step 1 will be emited at the output of the node. + +![statuses](img/hold-statuses.png) diff --git a/hold/hold.js b/hold/hold.js index 4457574..c8a2a63 100644 --- a/hold/hold.js +++ b/hold/hold.js @@ -5,14 +5,18 @@ module.exports = function(RED) { var node = this; var msg = {}; node.context().storedmessage = node.context().storedmessage || null; + node.status({"shape":"dot","fill":"grey","text":"No message in buffer"}) this.on('input', function (msg) { if ((msg.trigger==null)||(msg.trigger!=true)) { node.context().storedmessage = msg; + node.status({"shape":"dot","fill":"blue","text":"Message hold"}) } else { if(node.context().storedmessage!=null) { node.send(node.context().storedmessage); + node.status({"shape":"dot","fill":"green","text":"Message triggered"}) } else { node.warn("Hold '"+n.name+"' triggered without message in buffer."); + node.status({"shape":"dot","fill":"yellow","text":"Triggered without message in buffer"}) } } }); diff --git a/img/hold-statuses.png b/img/hold-statuses.png new file mode 100644 index 0000000..7fc1551 Binary files /dev/null and b/img/hold-statuses.png differ diff --git a/package.json b/package.json index b9ab6bd..f1f368d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-hold", - "version": "1.0.0", + "version": "1.1.0", "description": "A node-red node which stores a message and emits it once it gets triggered", "dependencies": {}, "keywords": [