copyNodeData method

Object? copyNodeData(
  1. Object nodedata
)

Make a copy of a node data object. This uses the value of #copyNodeDataFunction to actually perform the copy, unless that property is null. When it is null the default behavior is to just make a shallow copy of the JavaScript Object.

However when #copiesArrays is true, this will make a copy of property values that are JavaScript Arrays. This is useful when you do not want the Arrays to be shared between the node data objects. Note that if you want to copy some property values that are Arrays but not other properties that are Arrays, you cannot use #copiesArrays but must implement your own #copyNodeDataFunction.

In addition when #copiesArrayObjects is true, if items in the Array being copied are JavaScript Objects, those objects are copied, recursively. This is useful when the items in copied Arrays are themselves objects that need to be copied. Note that if you want to share references to some but not all of the objects in copied Arrays you cannot use #copiesArrayObjects but must implement your own #copyNodeDataFunction.

This does not modify the model -- the returned data object is not added to this model. This assumes that the data's constructor can be called with no arguments.

Models should not have any references to Diagrams or GraphObjects or Tools or Layouts or other objects that form a Diagram.

Warning: there should not be any cyclical references within the model data, unless you either do not turn on #copiesArrays or #copiesArrayObjects or unless you have supplied your own #copyNodeDataFunction that can handle cyclical references. @expose @param {Object} nodedata a JavaScript object represented by a node, group, or non-link. @return {Object} @see #addNodeData

Implementation

_i2.Object? copyNodeData(_i2.Object nodedata) => _i4.callMethod(
      this,
      'copyNodeData',
      [nodedata],
    );