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

Add _module to Node object to provide module info

This commit is contained in:
Nick O'Leary 2022-01-12 11:07:25 +00:00
parent f8c47f59bc
commit ea43729063
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 5 additions and 0 deletions

View File

@ -83,6 +83,7 @@ function createNode(flow,config) {
} }
} }
try { try {
Object.defineProperty(conf,'_module', {value: typeRegistry.getNodeInfo(type), enumerable: false, writable: true })
Object.defineProperty(conf,'_flow', {value: flow, enumerable: false, writable: true }) Object.defineProperty(conf,'_flow', {value: flow, enumerable: false, writable: true })
newNode = new nodeTypeConstructor(conf); newNode = new nodeTypeConstructor(conf);
} catch (err) { } catch (err) {

View File

@ -59,6 +59,9 @@ function Node(n) {
// which we can tolerate as they are the same object. // which we can tolerate as they are the same object.
Object.defineProperty(this,'_flow', {value: n._flow, enumerable: false, writable: true }) Object.defineProperty(this,'_flow', {value: n._flow, enumerable: false, writable: true })
} }
if (n._module) {
Object.defineProperty(this,'_module', {value: n._module, enumerable: false, writable: true })
}
this.updateWires(n.wires); this.updateWires(n.wires);
} }
@ -484,6 +487,7 @@ function log_helper(self, level, msg) {
level: level, level: level,
id: self.id, id: self.id,
type: self.type, type: self.type,
module: self._module,
msg: msg msg: msg
}; };
if (self._alias) { if (self._alias) {