add reset capability to rue node

This commit is contained in:
Dave Conway-Jones
2017-12-20 16:28:32 +00:00
parent 51124f456d
commit 032a9d6435
4 changed files with 71 additions and 1 deletions

View File

@@ -18,6 +18,12 @@ module.exports = function(RED) {
node.previous = {};
this.on("input",function(msg) {
if (msg.hasOwnProperty("reset")) {
if (msg.hasOwnProperty("topic") && (typeof msg.topic === "string") && (msg.topic !== "")) {
delete node.previous[msg.topic];
}
else { node.previous = {}; }
}
if (msg.hasOwnProperty("payload")) {
var t = msg.topic || "_no_topic";
if ((this.func === "rbe") || (this.func === "rbei")) {