Skip to main content

Home > @jsplumbtoolkit/core > JsPlumbToolkit > addNode

JsPlumbToolkit.addNode() method

Adds a Node with the given data. If the data is null, the Toolkit creates an empty object and assigns a uuid as the Node's id. If no id can be derived for the given data, the Toolkit creates a uuid and sets it as the data object's 'id' member. This method also calls the current portExtractor function, if one was supplied. Its purpose is to extract any Ports from the data for some given Node.

Signature:

addNode(data: ObjectData, eventInfo?: any, doNotFireEvent?: boolean): Node;

Parameters

ParameterTypeDescription
dataObjectDataThe Node's backing data - from your data model.
eventInfoanyOptional data member that the Toolkit will pass into any registered event listeners. This can be used by the UI layer, for instance, to track the position on screen of any newly added elements.
doNotFireEventboolean

Returns:

Node

A Node object. Your original data is available via the data member. The Node's id is available via the id member.