#

API Docs for:
Show: Inherited Protected Private Deprecated

# LGraphNode Class

Defined in: `../src/litegraph.js:1830`

Base Class for all the node type classes

- Index
- Methods

## Item Index

### Methods

- addConnection
- addInput
- addInputs
- addOutput
- addOutputs
- addProperty
- addWidget
- clearTriggeredSlot
- collapse
- computeSize
- configure
- connect
- disconnectInput
- disconnectOutput
- findInputSlot
- findOutputSlot
- getBounding
- getConnectionPos
- getInputData
- getInputDataByName
- getInputDataType
- getInputInfo
- getInputNode
- getInputOrProperty
- getOutputData
- getOutputInfo
- getOutputNodes
- getSlotInPosition
- getTitle
- isAnyOutputConnected
- isInputConnected
- isOutputConnected
- isPointInside
- pin
- removeInput
- removeOutput
- serialize
- setOutputData
- setOutputDataType
- toString
- trigger
- triggerSlot

## Methods

### `addConnection`

(

- `name`
- `type`
- `pos`
- `direction`

)

Defined in `../src/litegraph.js:2665`

add an special connection to this node (used for special kinds of graphs)

#### Parameters:

- `name` String
- `type` String

  string defining the input type ("vec3","number",...)

- `pos` x,y

  position of the connection inside the node

- `direction` String

  if is input or output

### `addInput`

(

- `name`
- `type`
- `extra_info`

)

Defined in `../src/litegraph.js:2590`

add a new input slot to use in this node

#### Parameters:

- `name` String
- `type` String

  string defining the input type ("vec3","number",...), it its a generic one use 0

- `extra_info` Object

  this can be used to have special properties of an input (label, color, position, etc)

### `addInputs`

(

- `array`

)

Defined in `../src/litegraph.js:2615`

add several new input slots in this node

#### Parameters:

- `array` Array

  of triplets like [[name,type,extra_info],[...]]

### `addOutput`

(

- `name`
- `type`
- `extra_info`

)

Defined in `../src/litegraph.js:2511`

add a new output slot to use in this node

#### Parameters:

- `name` String
- `type` String

  string defining the output type ("vec3","number",...)

- `extra_info` Object

  this can be used to have special properties of an output (label, special color, position, etc)

### `addOutputs`

(

- `array`

)

Defined in `../src/litegraph.js:2535`

add a new output slot to use in this node

#### Parameters:

- `array` Array

  of triplets like [[name,type,extra_info],[...]]

### `addProperty`

(

- `name`
- `default_value`
- `type`
- `extra_info`

)

Defined in `../src/litegraph.js:2485`

add a new property to this node

#### Parameters:

- `name` String
- `default_value`
- `type` String

  string defining the output type ("vec3","number",...)

- `extra_info` Object

  this can be used to have special properties of the property (like values, etc)

### `addWidget`

() Object

Defined in `../src/litegraph.js:2753`

Allows to pass

#### Returns:

Object:

the created widget

### `clearTriggeredSlot`

(

- `slot`
- `link_id`

)

Defined in `../src/litegraph.js:2453`

clears the trigger slot animation

#### Parameters:

- `slot` Number

  the index of the output slot

- `link_id` Number

  [optional] in case you want to trigger and specific output link in a slot

### `collapse`

()

Defined in `../src/litegraph.js:3390`

Collapse the node to make it smaller on the canvas

### `computeSize`

(

- `minHeight`

)
Number

Defined in `../src/litegraph.js:2686`

computes the size of a node according to its inputs and output slots

#### Parameters:

- `minHeight` Number

#### Returns:

Number:

the total size

### `configure`

()

Defined in `../src/litegraph.js:1881`

configure a node from an object containing the serialized info

### `connect`

(

- `slot`
- `node`
- `target_slot`

)
Object

Defined in `../src/litegraph.js:2899`

connect this node output to the input of another node

#### Parameters:

- `slot` Number_or_string

  (could be the number of the slot or the string with the name of the slot)

- `node` LGraphNode

  the target node

- `target_slot` Number_or_string

  the input slot of the target node (could be the number of the slot or the string with the name of the slot, or -1 to connect a trigger)

#### Returns:

Object:

the link_info is created, otherwise null

### `disconnectInput`

(

- `slot`

)
Boolean

Defined in `../src/litegraph.js:3132`

disconnect one input

#### Parameters:

- `slot` Number_or_string

  (could be the number of the slot or the string with the name of the slot)

#### Returns:

Boolean:

if it was disconnected succesfully

### `disconnectOutput`

(

- `slot`
- `target_node`

)
Boolean

Defined in `../src/litegraph.js:3024`

disconnect one output to an specific node

#### Parameters:

- `slot` Number_or_string

  (could be the number of the slot or the string with the name of the slot)

- `target_node` LGraphNode

  the target node to which this slot is connected [Optional, if not target_node is specified all nodes will be disconnected]

#### Returns:

Boolean:

if it was disconnected succesfully

### `findInputSlot`

(

- `name`

)
Number

Defined in `../src/litegraph.js:2868`

returns the input slot with a given name (used for dynamic slots), -1 if not found

#### Parameters:

- `name` String

  the name of the slot

#### Returns:

Number:

the slot (-1 if not found)

### `findOutputSlot`

(

- `name`

)
Number

Defined in `../src/litegraph.js:2884`

returns the output slot with a given name (used for dynamic slots), -1 if not found

#### Parameters:

- `name` String

  the name of the slot

#### Returns:

Number:

the slot (-1 if not found)

### `getBounding`

() Float32Array4

Defined in `../src/litegraph.js:2791`

returns the bounding of the object, used for rendering purposes bounding is: [topleft_cornerx, topleft_cornery, width, height]

#### Returns:

Float32Array4:

the total size

### `getConnectionPos`

(

- `is_input`
- `slot`
- `out`

)
x,y

Defined in `../src/litegraph.js:3206`

returns the center of a connection point in canvas coords

#### Parameters:

- `is_input` Boolean

  true if if a input slot, false if it is an output

- `slot` Number_or_string

  (could be the number of the slot or the string with the name of the slot)

- `out` Vec2

  [optional] a place to store the output, to free garbage

#### Returns:

x,y:

the position

### `getInputData`

(

- `slot`
- `force_update`

)

Defined in `../src/litegraph.js:2129`

Retrieves the input data (data traveling through the connection) from one slot

#### Parameters:

- `slot` Number
- `force_update` Boolean

  if set to true it will force the connected node of this slot to output data into this link

#### Returns:

:

data or if it is not connected returns undefined

### `getInputDataByName`

(

- `slot_name`
- `force_update`

)

Defined in `../src/litegraph.js:2191`

Retrieves the input data from one slot using its name instead of slot number

#### Parameters:

- `slot_name` String
- `force_update` Boolean

  if set to true it will force the connected node of this slot to output data into this link

#### Returns:

:

data or if it is not connected returns null

### `getInputDataType`

(

- `slot`

)
String

Defined in `../src/litegraph.js:2165`

Retrieves the input data type (in case this supports multiple input types)

#### Parameters:

- `slot` Number

#### Returns:

String:

datatype in string format

### `getInputInfo`

(

- `slot`

)
Object

Defined in `../src/litegraph.js:2220`

tells you info about an input connection (which node, type, etc)

#### Parameters:

- `slot` Number

#### Returns:

Object:

object or null { link: id, name: string, type: string or 0 }

### `getInputNode`

(

- `slot`

)
LGraphNode

Defined in `../src/litegraph.js:2235`

returns the node connected in the input slot

#### Parameters:

- `slot` Number

#### Returns:

LGraphNode:

node or null

### `getInputOrProperty`

(

- `name`

)

Defined in `../src/litegraph.js:2257`

returns the value of an input with this name, otherwise checks if there is a property with that name

#### Parameters:

- `name` String

#### Returns:

:

value

### `getOutputData`

(

- `slot`

)
Object

Defined in `../src/litegraph.js:2284`

tells you the last output data that went in that slot

#### Parameters:

- `slot` Number

#### Returns:

Object:

object or null

### `getOutputInfo`

(

- `slot`

)
Object

Defined in `../src/litegraph.js:2302`

tells you info about an output connection (which node, type, etc)

#### Parameters:

- `slot` Number

#### Returns:

Object:

object or null { name: string, type: string, links: [ ids of links in number ] }

### `getOutputNodes`

(

- `slot`

)
Array

Defined in `../src/litegraph.js:2347`

retrieves all the nodes connected to this output slot

#### Parameters:

- `slot` Number

#### Returns:

Array:

### `getSlotInPosition`

(

- `x`
- `y`

)
Object

Defined in `../src/litegraph.js:2836`

checks if a point is inside a node slot, and returns info about which slot

#### Parameters:

- `x` Number
- `y` Number

#### Returns:

Object:

if found the object contains { input|output: slot object, slot: number, link_pos: [x,y] }

### `getTitle`

()

Defined in `../src/litegraph.js:2051`

get the title string

### `isAnyOutputConnected`

() Boolean

Defined in `../src/litegraph.js:2331`

tells you if there is any connection in the output slots

#### Returns:

Boolean:

### `isInputConnected`

(

- `slot`

)
Boolean

Defined in `../src/litegraph.js:2207`

tells you if there is a connection in one input slot

#### Parameters:

- `slot` Number

#### Returns:

Boolean:

### `isOutputConnected`

(

- `slot`

)
Boolean

Defined in `../src/litegraph.js:2318`

tells you if there is a connection in one output slot

#### Parameters:

- `slot` Number

#### Returns:

Boolean:

### `isPointInside`

(

- `x`
- `y`

)
Boolean

Defined in `../src/litegraph.js:2810`

checks if a point is inside the shape of a node

#### Parameters:

- `x` Number
- `y` Number

#### Returns:

Boolean:

### `pin`

()

Defined in `../src/litegraph.js:3406`

Forces the node to do not move or realign on Z

### `removeInput`

(

- `slot`

)

Defined in `../src/litegraph.js:2641`

remove an existing input slot

#### Parameters:

- `slot` Number

### `removeOutput`

(

- `slot`

)

Defined in `../src/litegraph.js:2561`

remove an existing output slot

#### Parameters:

- `slot` Number

### `serialize`

()

Defined in `../src/litegraph.js:1949`

serialize the content

### `setOutputData`

(

- `slot`
- `data`

)

Defined in `../src/litegraph.js:2064`

sets the output data

#### Parameters:

- `slot` Number
- `data`

### `setOutputDataType`

(

- `slot`
- `datatype`

)

Defined in `../src/litegraph.js:2100`

sets the output data type, useful when you want to be able to overwrite the data type

#### Parameters:

- `slot` Number
- `datatype` String

### `toString`

()

Defined in `../src/litegraph.js:2039`

serialize and stringify

### `trigger`

(

- `event`
- `param`

)

Defined in `../src/litegraph.js:2380`

Triggers an event in this node, this will trigger any output with the same name

#### Parameters:

- `event` String

  name ( "on_play", ... ) if action is equivalent to false then the event is send to all

- `param`

### `triggerSlot`

(

- `slot`
- `param`
- `link_id`

)

Defined in `../src/litegraph.js:2403`

Triggers an slot event in this node

#### Parameters:

- `slot` Number

  the index of the output slot

- `param`
- `link_id` Number

  [optional] in case you want to trigger and specific output link in a slot