(de)Register consumer nodes at config node

In order for error messages to be catchable
This commit is contained in:
bvmensvoort
2023-06-11 10:45:13 +02:00
committed by Skylar Sadlier
parent 8ca11f36d8
commit 124a0cba34
15 changed files with 79 additions and 0 deletions
+9
View File
@@ -44,6 +44,7 @@ module.exports = function(RED) {
this.credentials = {};
}
this.users = {};
this.connected = null;
this.name = n.name;
this.userId = this.credentials.userId;
@@ -423,6 +424,14 @@ module.exports = function(RED) {
}
)
})();
// Keep track of all consumers of this node to be able to catch errors
node.register = function(consumerNode) {
node.users[consumerNode.id] = consumerNode;
};
node.deregister = function(consumerNode) {
delete node.users[consumerNode.id];
};
}
}