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

Make Node._flow a writeable property

This is needed so an existing node constructor that does:

   Object.assign(this,config);

works when it tries to replace this._flow with config._flow.
This commit is contained in:
Nick O'Leary 2019-01-30 10:50:29 +00:00
parent d534a8952d
commit 85de227003
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -38,7 +38,11 @@ function Node(n) {
// Make this a non-enumerable property as it may cause // Make this a non-enumerable property as it may cause
// circular references. Any existing code that tries to JSON serialise // circular references. Any existing code that tries to JSON serialise
// the object (such as dashboard) will not like circular refs // the object (such as dashboard) will not like circular refs
Object.defineProperty(this,'_flow', {value: n._flow, }) // The value must still be writable in the case that a node does:
// Object.assign(this,config)
// as part of its constructure - config._flow will overwrite this._flow
// which we can tolerate as they are the same object.
Object.defineProperty(this,'_flow', {value: n._flow, enumerable: false, writable: true })
} }
this.updateWires(n.wires); this.updateWires(n.wires);
} }