Skip to main content

Home > @jsplumbtoolkit/core > JsPlumbToolkit > addFactoryNode

JsPlumbToolkit.addFactoryNode() method#

Adds a Node by type, running the data generation for the node through the current NodeFactory. This is different from addNode in that with addNode you are supplying the final data and your NodeFactory is not called. This method can be called with one, two or three arguments. A single argument is considered to be the new Node's type, and a backing data object will be created with this set, and no callback will occur. If you provide two arguments the second argument may be either the new Node's backing data OR a callback to hit with the newly created Node. With three arguments the second argument is the Node's backing data and the third is a callback to hit with the newly created Node.

Signature:

addFactoryNode(type: string, data?: ObjectData, continueCallback?: Function, abortCallback?: Function): void;

Parameters#

ParameterTypeDescription
typestringRequired. Type of the object to create. type will be passed as the first argument to your node factory.
dataObjectDataOptional backing data for the Node.
continueCallbackFunctionOptional function to call with the newly created Node.
abortCallbackFunctionOptional function to call if the factory aborted the node add.

Returns:

void