Skip to content

@gausszhou/litegraph-core / LGraphNode

Class: LGraphNode ​

Defined in: packages/core/src/LGraphNode.ts:111

https://github.com/jagenjo/litegraph.js/blob/master/guides/README.md#lgraphnode

Extended by ​

Constructors ​

Constructor ​

ts
new LGraphNode(): LGraphNode;

Defined in: packages/core/src/LGraphNode.ts:124

Returns ​

LGraphNode

Properties ​

_collapsed_width? ​

ts
_collapsed_width?: number;

Defined in: packages/core/src/LGraphNode.ts:222


_level ​

ts
_level: number;

Defined in: packages/core/src/LGraphNode.ts:204


_relative_id ​

ts
_relative_id: string | number | null = null;

Defined in: packages/core/src/LGraphNode.ts:203


action_call ​

ts
action_call: string | null = null;

Defined in: packages/core/src/LGraphNode.ts:224


action_triggered ​

ts
action_triggered: number = 0;

Defined in: packages/core/src/LGraphNode.ts:228

the nFrames it will be used (-- each step), means "how old" is the event


bgcolor ​

ts
bgcolor: string;

Defined in: packages/core/src/LGraphNode.ts:192


block_delete ​

ts
block_delete: boolean = false;

Defined in: packages/core/src/LGraphNode.ts:198


boxcolor ​

ts
boxcolor: string;

Defined in: packages/core/src/LGraphNode.ts:193


category ​

ts
category: string | null;

Defined in: packages/core/src/LGraphNode.ts:152


class ​

ts
class: new () => LGraphNode;

Defined in: packages/core/src/LGraphNode.ts:169

Returns ​

LGraphNode


clip_area ​

ts
clip_area: boolean;

Defined in: packages/core/src/LGraphNode.ts:214

if you render outside the node, it will be clipped


clonable ​

ts
clonable: boolean = true;

Defined in: packages/core/src/LGraphNode.ts:166


collapsable ​

ts
collapsable: boolean = true;

Defined in: packages/core/src/LGraphNode.ts:167


color ​

ts
color: string;

Defined in: packages/core/src/LGraphNode.ts:191


connections ​

ts
connections: INodeConnection[];

Defined in: packages/core/src/LGraphNode.ts:179


desc ​

ts
desc: string = "";

Defined in: packages/core/src/LGraphNode.ts:150


exec_version ​

ts
exec_version: number = 0;

Defined in: packages/core/src/LGraphNode.ts:223


execute_triggered ​

ts
execute_triggered: number = 0;

Defined in: packages/core/src/LGraphNode.ts:226

the nFrames it will be used (-- each step), means "how old" is the event


flags ​

ts
flags: Partial<{
  collapsed: boolean;
  pinned: boolean;
  skip_repeated_outputs: boolean;
}>;

Defined in: packages/core/src/LGraphNode.ts:185


graph ​

ts
graph: LGraph | null;

Defined in: packages/core/src/LGraphNode.ts:155


graph_version ​

ts
graph_version: number;

Defined in: packages/core/src/LGraphNode.ts:156


has_errors? ​

ts
has_errors?: boolean;

Defined in: packages/core/src/LGraphNode.ts:220

if true, the node will show the bgcolor as 'red'


hide_in_node_lists ​

ts
hide_in_node_lists: boolean = false;

Defined in: packages/core/src/LGraphNode.ts:197


horizontal ​

ts
horizontal: boolean;

Defined in: packages/core/src/LGraphNode.ts:218

slots are distributed horizontally


id ​

ts
id: NodeID;

Defined in: packages/core/src/LGraphNode.ts:171


ignore_remove ​

ts
ignore_remove: boolean = false;

Defined in: packages/core/src/LGraphNode.ts:199


inputs ​

ts
inputs: INodeInputSlot[];

Defined in: packages/core/src/LGraphNode.ts:177


is_selected ​

ts
is_selected: boolean;

Defined in: packages/core/src/LGraphNode.ts:159


last_serialization? ​

ts
last_serialization?: 
  | SerializedLGraphNode<LGraphNode>
  | null = null;

Defined in: packages/core/src/LGraphNode.ts:201


mode? ​

ts
mode?: NodeMode;

Defined in: packages/core/src/LGraphNode.ts:207

Used in LGraphCanvas.onMenuNodeMode


mouseOver ​

ts
mouseOver: boolean;

Defined in: packages/core/src/LGraphNode.ts:160


order ​

ts
order: number;

Defined in: packages/core/src/LGraphNode.ts:163


outputs ​

ts
outputs: INodeOutputSlot[];

Defined in: packages/core/src/LGraphNode.ts:178


pos ​

ts
pos: Vector2;

Defined in: packages/core/src/LGraphNode.ts:154


priority ​

ts
priority: number = 0;

Defined in: packages/core/src/LGraphNode.ts:162

computeExecutionOrder sorts by priority first, then order if priorities are the same


properties ​

ts
properties: Record<string, any>;

Defined in: packages/core/src/LGraphNode.ts:182


properties_info ​

ts
properties_info: IProperty[];

Defined in: packages/core/src/LGraphNode.ts:183


redraw_on_mouse ​

ts
redraw_on_mouse: boolean;

Defined in: packages/core/src/LGraphNode.ts:164


removable ​

ts
removable: boolean = true;

Defined in: packages/core/src/LGraphNode.ts:165


resizable ​

ts
resizable: boolean;

Defined in: packages/core/src/LGraphNode.ts:216

if set to false it wont be resizable with the mouse


serialize_widgets ​

ts
serialize_widgets: boolean = false;

Defined in: packages/core/src/LGraphNode.ts:196


shape ​

ts
shape: number;

Defined in: packages/core/src/LGraphNode.ts:194


size ​

ts
size: Vector2;

Defined in: packages/core/src/LGraphNode.ts:153


skip_subgraph_button ​

ts
skip_subgraph_button: boolean = false;

Defined in: packages/core/src/LGraphNode.ts:158


subgraph ​

ts
subgraph: LGraph | null = null;

Defined in: packages/core/src/LGraphNode.ts:157


title ​

ts
title: string;

Defined in: packages/core/src/LGraphNode.ts:149


titleMode ​

ts
titleMode: TitleMode = TitleMode.NORMAL_TITLE;

Defined in: packages/core/src/LGraphNode.ts:168


type ​

ts
type: string | null;

Defined in: packages/core/src/LGraphNode.ts:151


widgets ​

ts
widgets: 
  | IWidget<any, any>[]
  | null
  | undefined;

Defined in: packages/core/src/LGraphNode.ts:173


widgets_start_y ​

ts
widgets_start_y: number;

Defined in: packages/core/src/LGraphNode.ts:212

widgets start at y distance from the top of the node


widgets_up ​

ts
widgets_up: boolean;

Defined in: packages/core/src/LGraphNode.ts:210

If set to true widgets do not start after the slots


widgets_values? ​

ts
widgets_values?: any[];

Defined in: packages/core/src/LGraphNode.ts:174


MAX_CONSOLE ​

ts
static MAX_CONSOLE: number = 100;

Defined in: packages/core/src/LGraphNode.ts:2787


title ​

ts
static title: string;

Defined in: packages/core/src/LGraphNode.ts:120


title_color ​

ts
static title_color: string;

Defined in: packages/core/src/LGraphNode.ts:119


type ​

ts
static type: string | null;

Defined in: packages/core/src/LGraphNode.ts:121


widgets_up ​

ts
static widgets_up: boolean;

Defined in: packages/core/src/LGraphNode.ts:122

Accessors ​

slotLayout ​

Get Signature ​

ts
get slotLayout(): SlotLayout | null;

Defined in: packages/core/src/LGraphNode.ts:112

Returns ​

SlotLayout | null

Methods ​

actionDo() ​

ts
actionDo(
   action, 
   param, 
   options?
): void;

Defined in: packages/core/src/LGraphNode.ts:1145

Triggers an action, wrapped by logics to control execution flow

Parameters ​

action ​

any

name

param ​

any

options? ​

LActionOptions = {}

Returns ​

void

Method ​

actionDo


addConnection() ​

ts
addConnection(
   name, 
   type, 
   pos, 
   direction
): INodeConnection;

Defined in: packages/core/src/LGraphNode.ts:1555

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 ​

Vector2

position of the connection inside the node

direction ​

string

if is input or output

Returns ​

INodeConnection


addCustomWidget() ​

ts
addCustomWidget<T>(customWidget): T;

Defined in: packages/core/src/LGraphNode.ts:1762

Type Parameters ​

T ​

T extends IWidget<any, any>

Parameters ​

customWidget ​

T

Returns ​

T


addInput() ​

ts
addInput(
   name, 
   type?, 
   extra_info?
): INodeInputSlot;

Defined in: packages/core/src/LGraphNode.ts:1459

add a new input slot to use in this node

Parameters ​

name ​

string

type? ​

SlotType = BuiltInSlotType.DEFAULT

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

extra_info? ​

Partial<INodeInputSlot>

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

Returns ​

INodeInputSlot


addOnExecutedOutput() ​

ts
addOnExecutedOutput(): number;

Defined in: packages/core/src/LGraphNode.ts:1065

Returns ​

number


addOnTriggerInput() ​

ts
addOnTriggerInput(): number;

Defined in: packages/core/src/LGraphNode.ts:1056

Returns ​

number


addOutput() ​

ts
addOutput(
   name, 
   type?, 
   extra_info?
): INodeOutputSlot;

Defined in: packages/core/src/LGraphNode.ts:1351

add a new output slot to use in this node

Parameters ​

name ​

string

type? ​

SlotType = BuiltInSlotType.DEFAULT

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

extra_info? ​

Partial<INodeOutputSlot>

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

Returns ​

INodeOutputSlot


addProperty() ​

ts
addProperty(
   name, 
   default_value, 
   type?, 
   extra_info?
): IProperty;

Defined in: packages/core/src/LGraphNode.ts:1322

add a new property to this node

Parameters ​

name ​

string

default_value ​

any

type? ​

string

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

extra_info? ​

Partial<IPropertyInfo>

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

Returns ​

IProperty


addWidget() ​

ts
addWidget<T>(
   type, 
   name, 
   value, 
   callback?, 
   options?
): T;

Defined in: packages/core/src/LGraphNode.ts:1707

https://github.com/jagenjo/litegraph.js/blob/master/guides/README.md#node-widgets

Type Parameters ​

T ​

T extends IWidget<any, any>

Parameters ​

type ​

T["type"]

name ​

string

value ​

T["value"]

callback? ​

string | WidgetCallback<T>

options? ​

T["options"]

Returns ​

T

created widget


alignToGrid() ​

ts
alignToGrid(): void;

Defined in: packages/core/src/LGraphNode.ts:2776

Force align to grid

Returns ​

void


captureInput() ​

ts
captureInput(v): void;

Defined in: packages/core/src/LGraphNode.ts:2824

Allows to get onMouseMove and onMouseUp events even if the mouse is out of focus

Parameters ​

v ​

any

Returns ​

void


changeMode() ​

ts
changeMode(modeTo): boolean;

Defined in: packages/core/src/LGraphNode.ts:1086

Parameters ​

modeTo ​

NodeMode

Returns ​

boolean


clearTriggeredSlot() ​

ts
clearTriggeredSlot(slot, link_id?): void;

Defined in: packages/core/src/LGraphNode.ts:1273

clears the trigger slot animation

Parameters ​

slot ​

number

the index of the output slot

LinkID

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

Returns ​

void


clone() ​

ts
clone(cloneData?): LGraphNode;

Defined in: packages/core/src/LGraphNode.ts:408

Creates a clone of this node

Parameters ​

cloneData? ​

LGraphNodeCloneData = ...

Returns ​

LGraphNode


collapse() ​

ts
collapse(force?): void;

Defined in: packages/core/src/LGraphNode.ts:2853

Collapse the node to make it smaller on the canvas

Parameters ​

force? ​

boolean = false

Returns ​

void


computeSize() ​

ts
computeSize(out?): Vector2;

Defined in: packages/core/src/LGraphNode.ts:1573

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

Parameters ​

out? ​

Vector2 = ...

Returns ​

Vector2


configure() ​

ts
configure(info): void;

Defined in: packages/core/src/LGraphNode.ts:237

configure a node from an object containing the serialized info

Parameters ​

info ​

SerializedLGraphNode

Returns ​

void


connect() ​

ts
connect<T>(
   slot, 
   targetNode, 
   targetSlot
): T | null;

Defined in: packages/core/src/LGraphNode.ts:2196

connect this node output to the input of another node

Type Parameters ​

T ​

T = any

Parameters ​

slot ​

string | number

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

targetNode ​

LGraphNode

the target node

targetSlot ​

string | number

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 ​

T | null

the linkInfo is created, otherwise null


connectByTypeInput() ​

ts
connectByTypeInput(
   slot, 
   targetNode, 
   targetSlotType, 
   optsIn?
): any;

Defined in: packages/core/src/LGraphNode.ts:2061

connect this node output to the input of another node BY TYPE

Parameters ​

slot ​

SlotNameOrIndex

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

targetNode ​

LGraphNode

targetSlotType ​

SlotType

optsIn? ​
createEventInCase? ​

boolean

firstFreeIfOutputGeneralInCase? ​

boolean

generalTypeInCase? ​

boolean

Returns ​

any

the link_info is created, otherwise null

Method ​

connectByType


connectByTypeOutput() ​

ts
connectByTypeOutput(
   slot, 
   sourceNode, 
   sourceSlotType, 
   optsIn?
): any;

Defined in: packages/core/src/LGraphNode.ts:2131

connect this node input to the output of another node BY TYPE

Parameters ​

slot ​

SlotNameOrIndex

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

sourceNode ​

LGraphNode

sourceSlotType ​

SlotType

optsIn? ​
createEventInCase? ​

boolean

firstFreeIfOutputGeneralInCase? ​

boolean

generalTypeInCase? ​

boolean

Returns ​

any

the link_info is created, otherwise null

Method ​

connectByType


disconnectInput() ​

ts
disconnectInput(slot, options?): boolean;

Defined in: packages/core/src/LGraphNode.ts:2597

disconnect one input

Parameters ​

slot ​

SlotNameOrIndex

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

options? ​
doProcessChange? ​

boolean

Returns ​

boolean

if it was disconnected successfully


disconnectOutput() ​

ts
disconnectOutput(
   slot, 
   targetNode?, 
   options?
): boolean;

Defined in: packages/core/src/LGraphNode.ts:2430

disconnect one output to an specific node

Parameters ​

slot ​

SlotNameOrIndex

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

targetNode? ​

LGraphNode

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

options? ​

object

Returns ​

boolean

if it was disconnected successfully


doExecute() ​

ts
doExecute(param?, options?): void;

Defined in: packages/core/src/LGraphNode.ts:1113

Parameters ​

param? ​

any

options? ​

LActionOptions = {}

Returns ​

void


findInputSlotByName() ​

ts
findInputSlotByName(
   name?, 
   onlyFree?, 
   typesNotAccepted?
): INodeInputSlot | null;

Defined in: packages/core/src/LGraphNode.ts:1906

Parameters ​

name? ​

string

onlyFree? ​

boolean = false

typesNotAccepted? ​

SlotType[]

Returns ​

INodeInputSlot | null


findInputSlotByType() ​

ts
findInputSlotByType(
   type, 
   preferFreeSlot?, 
   doNotUseOccupied?
): INodeInputSlot | null;

Defined in: packages/core/src/LGraphNode.ts:1982

findSlotByType for INPUTS

Parameters ​

type ​

SlotType

preferFreeSlot? ​

boolean = false

doNotUseOccupied? ​

boolean = false

Returns ​

INodeInputSlot | null


findInputSlotIndexByName() ​

ts
findInputSlotIndexByName(
   name?, 
   onlyFree?, 
   typesNotAccepted?
): number;

Defined in: packages/core/src/LGraphNode.ts:1888

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

Parameters ​

name? ​

string

the name of the slot

onlyFree? ​

boolean = false

typesNotAccepted? ​

SlotType[]

Returns ​

number

the slot (-1 if not found)


findInputSlotIndexByType() ​

ts
findInputSlotIndexByType(
   type, 
   preferFreeSlot?, 
   doNotUseOccupied?
): number;

Defined in: packages/core/src/LGraphNode.ts:1968

findSlotByType for INPUTS

Parameters ​

type ​

SlotType

preferFreeSlot? ​

boolean = false

doNotUseOccupied? ​

boolean = false

Returns ​

number


findOutputSlotByName() ​

ts
findOutputSlotByName(
   name?, 
   onlyFree?, 
   typesNotAccepted?
): INodeOutputSlot | null;

Defined in: packages/core/src/LGraphNode.ts:1947

Parameters ​

name? ​

string

onlyFree? ​

boolean = false

typesNotAccepted? ​

SlotType[]

Returns ​

INodeOutputSlot | null


findOutputSlotByType() ​

ts
findOutputSlotByType(
   type, 
   preferFreeSlot?, 
   doNotUseOccupied?
): INodeOutputSlot | null;

Defined in: packages/core/src/LGraphNode.ts:1989

findSlotByType for OUTPUTS

Parameters ​

type ​

SlotType

preferFreeSlot? ​

boolean = false

doNotUseOccupied? ​

boolean = false

Returns ​

INodeOutputSlot | null


findOutputSlotIndexByName() ​

ts
findOutputSlotIndexByName(
   name?, 
   onlyFree?, 
   typesNotAccepted?
): number;

Defined in: packages/core/src/LGraphNode.ts:1929

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

Parameters ​

name? ​

string

the name of the slot

onlyFree? ​

boolean = false

typesNotAccepted? ​

SlotType[]

Returns ​

number

the slot (-1 if not found)


findOutputSlotIndexByType() ​

ts
findOutputSlotIndexByType(
   type, 
   preferFreeSlot?, 
   doNotUseOccupied?
): number;

Defined in: packages/core/src/LGraphNode.ts:1975

findSlotByType for OUTPUTS

Parameters ​

type ​

SlotType

preferFreeSlot? ​

boolean = false

doNotUseOccupied? ​

boolean = false

Returns ​

number


getBounding() ​

ts
getBounding(out?): Float32Array;

Defined in: packages/core/src/LGraphNode.ts:1780

returns the bounding of the object, used for rendering purposes

Parameters ​

out? ​

Float32Array<ArrayBufferLike>

Returns ​

Float32Array

[x, y, width, height]


getConnectionPos() ​

ts
getConnectionPos(
   is_input, 
   slotNumber, 
   out?, 
   ignore_collapsed?
): Vector2;

Defined in: packages/core/src/LGraphNode.ts:2693

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

slotNumber ​

number

out? ​

Vector2 = ...

a place to store the output, to free garbage

ignore_collapsed? ​

boolean = false

Returns ​

Vector2

the position


getExtraLinkOptions()? ​

ts
getExtraLinkOptions?(
   graphCanvas, 
   link, 
   linkType, 
   options
): ContextMenuItem[];

Defined in: packages/core/src/LGraphNode.ts:3126

Parameters ​

graphCanvas ​

LGraphCanvas

LLink

linkType ​

LConnectionKind

options ​

ContextMenuItem[]

Returns ​

ContextMenuItem[]


getExtraMenuOptions()? ​

ts
getExtraMenuOptions?(graphCanvas, options): ContextMenuItem[];

Defined in: packages/core/src/LGraphNode.ts:3125

Parameters ​

graphCanvas ​

LGraphCanvas

options ​

ContextMenuItem[]

Returns ​

ContextMenuItem[]


getInputData() ​

ts
getInputData<T>(slot, force_update?): T;

Defined in: packages/core/src/LGraphNode.ts:688

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

Type Parameters ​

T ​

T = any

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 ​

T

data or if it is not connected returns undefined


getInputDataByName() ​

ts
getInputDataByName<T>(slot_name, force_update?): T;

Defined in: packages/core/src/LGraphNode.ts:763

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

Type Parameters ​

T ​

T = any

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 ​

T

data or if it is not connected returns null


getInputDataType() ​

ts
getInputDataType(slot): SlotType | null;

Defined in: packages/core/src/LGraphNode.ts:730

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

Parameters ​

slot ​

number

Returns ​

SlotType | null

datatype in string format


getInputInfo() ​

ts
getInputInfo(slot): INodeInputSlot | null;

Defined in: packages/core/src/LGraphNode.ts:780

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

Parameters ​

slot ​

number

Returns ​

INodeInputSlot | null


ts
getInputLink(slot): LLink | null;

Defined in: packages/core/src/LGraphNode.ts:795

Returns the link info in the connection of an input slot

Parameters ​

slot ​

number

Returns ​

LLink | null

object or null


getInputNode() ​

ts
getInputNode(slot): LGraphNode | null;

Defined in: packages/core/src/LGraphNode.ts:810

returns the node connected in the input slot

Parameters ​

slot ​

number

Returns ​

LGraphNode | null


getInputOrProperty() ​

ts
getInputOrProperty<T>(name): T;

Defined in: packages/core/src/LGraphNode.ts:835

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

Type Parameters ​

T ​

T = any

Parameters ​

name ​

string

Returns ​

T


getInputSlotProperty() ​

ts
getInputSlotProperty(slot, name): any;

Defined in: packages/core/src/LGraphNode.ts:503

Parameters ​

slot ​

number

name ​

string

Returns ​

any


getInputSlotsConnectedTo() ​

ts
getInputSlotsConnectedTo(slot): INodeInputSlot[];

Defined in: packages/core/src/LGraphNode.ts:948

Returns the input slots in other nodes that an output in this node is connected to.

Parameters ​

slot ​

number

Returns ​

INodeInputSlot[]

object or null


getMenuOptions()? ​

ts
getMenuOptions?(graphCanvas): ContextMenuItem[];

Defined in: packages/core/src/LGraphNode.ts:3124

Called by LGraphCanvas.processContextMenu

Parameters ​

graphCanvas ​

LGraphCanvas

Returns ​

ContextMenuItem[]


getOptionalSlots() ​

ts
getOptionalSlots(): OptionalSlots | null;

Defined in: packages/core/src/LGraphNode.ts:3115

Returns ​

OptionalSlots | null


getOutputData() ​

ts
getOutputData<T>(slot): T | null;

Defined in: packages/core/src/LGraphNode.ts:910

tells you the last output data that went in that slot

Type Parameters ​

T ​

T = any

Parameters ​

slot ​

number

Returns ​

T | null


getOutputInfo() ​

ts
getOutputInfo(slot): INodeOutputSlot | null;

Defined in: packages/core/src/LGraphNode.ts:970

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

Parameters ​

slot ​

number

Returns ​

INodeOutputSlot | null


ts
getOutputLinks(slot): LLink[];

Defined in: packages/core/src/LGraphNode.ts:927

Returns the link info in the connection of an output slot

Parameters ​

slot ​

number

Returns ​

LLink[]

object or null


getOutputNodes() ​

ts
getOutputNodes(slot): LGraphNode[];

Defined in: packages/core/src/LGraphNode.ts:1006

retrieves all the nodes connected to this output slot

Parameters ​

slot ​

number

Returns ​

LGraphNode[]


getOutputSlotConnectedTo() ​

ts
getOutputSlotConnectedTo(slot): INodeOutputSlot | null;

Defined in: packages/core/src/LGraphNode.ts:886

Returns the output slot in another node that an input in this node is connected to.

Parameters ​

slot ​

number

Returns ​

INodeOutputSlot | null

object or null


getOutputSlotProperty() ​

ts
getOutputSlotProperty(slot, name): any;

Defined in: packages/core/src/LGraphNode.ts:521

Parameters ​

slot ​

number

name ​

string

Returns ​

any


getPropertyInfo() ​

ts
getPropertyInfo(property): IPropertyInfo;

Defined in: packages/core/src/LGraphNode.ts:1668

returns all the info available about a property of this node.

Parameters ​

property ​

string

name of the property

Returns ​

IPropertyInfo

the object with all the available info

Method ​

getPropertyInfo


getRootGraph() ​

ts
getRootGraph(): LGraph | null;

Defined in: packages/core/src/LGraphNode.ts:455

Returns ​

LGraph | null


getSlotInPosition() ​

ts
getSlotInPosition(x, y): SlotInPosition | null;

Defined in: packages/core/src/LGraphNode.ts:1831

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

Parameters ​

x ​

number

y ​

number

Returns ​

SlotInPosition | null


getSlotMenuOptions()? ​

ts
getSlotMenuOptions?(slot): ContextMenuItem[];

Defined in: packages/core/src/LGraphNode.ts:3127

Parameters ​

slot ​

SlotInPosition

Returns ​

ContextMenuItem[]


getTitle() ​

ts
getTitle(): string;

Defined in: packages/core/src/LGraphNode.ts:451

get the title string

Returns ​

string


is() ​

ts
is<T>(ctor): this is T;

Defined in: packages/core/src/LGraphNode.ts:1878

Type Parameters ​

T ​

T extends LGraphNode

Parameters ​

ctor ​

new () => T

Returns ​

this is T


isAnyOutputConnected() ​

ts
isAnyOutputConnected(): boolean;

Defined in: packages/core/src/LGraphNode.ts:993

tells you if there is any connection in the output slots

Returns ​

boolean


isInputConnected() ​

ts
isInputConnected(slot): boolean;

Defined in: packages/core/src/LGraphNode.ts:772

tells you if there is a connection in one input slot

Parameters ​

slot ​

number

Returns ​

boolean


isOutputConnected() ​

ts
isOutputConnected(slot): boolean;

Defined in: packages/core/src/LGraphNode.ts:981

tells you if there is a connection in one output slot

Parameters ​

slot ​

number

Returns ​

boolean


isPointInside() ​

ts
isPointInside(
   x, 
   y, 
   margin?, 
   skipTitle?
): boolean;

Defined in: packages/core/src/LGraphNode.ts:1794

checks if a point is inside the shape of a node

Parameters ​

x ​

number

y ​

number

margin? ​

number = 0

skipTitle? ​

boolean = false

Returns ​

boolean


isShowingTitle() ​

ts
isShowingTitle(mouseOver): boolean;

Defined in: packages/core/src/LGraphNode.ts:2843

Parameters ​

mouseOver ​

boolean

Returns ​

boolean


ts
iterateAllLinks(): Iterable<LLink>;

Defined in: packages/core/src/LGraphNode.ts:1034

Returns ​

Iterable<LLink>


iterateInputInfo() ​

ts
iterateInputInfo(): Iterable<INodeInputSlot>;

Defined in: packages/core/src/LGraphNode.ts:677

Returns ​

Iterable<INodeInputSlot>


iterateOutputInfo() ​

ts
iterateOutputInfo(): Iterable<INodeOutputSlot>;

Defined in: packages/core/src/LGraphNode.ts:904

Returns ​

Iterable<INodeOutputSlot>


iterateParentSubgraphNodes() ​

ts
iterateParentSubgraphNodes(): Iterable<Subgraph>;

Defined in: packages/core/src/LGraphNode.ts:467

Returns ​

Iterable<Subgraph>


loadImage() ​

ts
loadImage(url): HTMLImageElement;

Defined in: packages/core/src/LGraphNode.ts:2812

Parameters ​

url ​

string

Returns ​

HTMLImageElement


localToScreen() ​

ts
localToScreen(
   x, 
   y, 
   graphCanvas
): Vector2;

Defined in: packages/core/src/LGraphNode.ts:2876

Parameters ​

x ​

number

y ​

number

graphCanvas ​

LGraphCanvas

Returns ​

Vector2


moveInput() ​

ts
moveInput(slot, newSlot): void;

Defined in: packages/core/src/LGraphNode.ts:1520

Parameters ​

slot ​

number

newSlot ​

number

Returns ​

void


moveOutput() ​

ts
moveOutput(slot, newSlot): void;

Defined in: packages/core/src/LGraphNode.ts:1421

Parameters ​

slot ​

number

newSlot ​

number

Returns ​

void


onAction()? ​

ts
onAction?(
   action, 
   param, 
   options
): void;

Defined in: packages/core/src/LGraphNode.ts:2991

Parameters ​

action ​

any

param ​

any

options ​

LActionOptions

Returns ​

void


onAdded()? ​

ts
onAdded?(graph): void;

Defined in: packages/core/src/LGraphNode.ts:3003

when added to graph (warning: this is called BEFORE the node is configured when loading) Called by LGraph.add

Parameters ​

graph ​

LGraph

Returns ​

void


onAddPropertyToPanel()? ​

ts
onAddPropertyToPanel?(name, panel): boolean;

Defined in: packages/core/src/LGraphNode.ts:3084

Parameters ​

name ​

string

panel ​

INodePanel

Returns ​

boolean


onAfterExecuteNode() ​

ts
onAfterExecuteNode(param, options?): void;

Defined in: packages/core/src/LGraphNode.ts:1074

Parameters ​

param ​

any

options? ​

object

Returns ​

void


onBeforeConnectInput()? ​

ts
onBeforeConnectInput?(inputIndex): number;

Defined in: packages/core/src/LGraphNode.ts:3053

Called just before connection (or disconnect - if input is linked). A convenient place to switch to another input, or create new one. This allow for ability to automatically add slots if needed

Parameters ​

inputIndex ​

number

Returns ​

number

selected input slot index, can differ from parameter value


onBounding()? ​

ts
onBounding?(area): boolean;

Defined in: packages/core/src/LGraphNode.ts:2935

Parameters ​

area ​

Float32Array

Returns ​

boolean


onConfigure()? ​

ts
onConfigure?(o): void;

Defined in: packages/core/src/LGraphNode.ts:2997

Called by LGraph.configure

Parameters ​

o ​

SerializedLGraphNode

Returns ​

void


onConnectInput()? ​

ts
onConnectInput?(
   inputIndex, 
   outputType, 
   outputSlot, 
   outputNode, 
   outputIndex
): boolean;

Defined in: packages/core/src/LGraphNode.ts:3020

if returns false the incoming connection will be canceled Called by LGraph.connect

Parameters ​

inputIndex ​

number

target input slot number

outputType ​

SlotType

type of output slot

outputSlot ​

INodeOutputSlot

output slot object

outputNode ​

LGraphNode

node containing the output

outputIndex ​

number

index of output slot

Returns ​

boolean


onConnectionsChange()? ​

ts
onConnectionsChange?(
   type, 
   slotIndex, 
   isConnected, 
   link, 
   ioSlot
): void;

Defined in: packages/core/src/LGraphNode.ts:3059

a connection changed (new one or removed) (LiteGraph.INPUT or LiteGraph.OUTPUT, slot, true if connected, linkInfo, input_info or output_info )

Parameters ​

type ​

LConnectionKind

slotIndex ​

number

isConnected ​

boolean

LLink

ioSlot ​

| INodeInputSlot | INodeOutputSlot

Returns ​

void


onConnectOutput()? ​

ts
onConnectOutput?(
   outputIndex, 
   inputType, 
   inputSlot, 
   inputNode, 
   inputIndex
): boolean;

Defined in: packages/core/src/LGraphNode.ts:3037

if returns false the incoming connection will be canceled Called by LGraph.connect

Parameters ​

outputIndex ​

number

target output slot number

inputType ​

SlotType

type of input slot

inputSlot ​

INodeInputSlot

input slot object

inputNode ​

LGraphNode

node containing the input

inputIndex ​

number

index of input slot

Returns ​

boolean


onDblClick()? ​

ts
onDblClick?(
   event, 
   pos, 
   graphCanvas
): void;

Defined in: packages/core/src/LGraphNode.ts:2969

Parameters ​

event ​

MouseEventExt

pos ​

Vector2

graphCanvas ​

LGraphCanvas

Returns ​

void


onDeselected()? ​

ts
onDeselected?(): void;

Defined in: packages/core/src/LGraphNode.ts:2986

Called by LGraphCanvas.deselectNode

Returns ​

void


onDrawBackground()? ​

ts
onDrawBackground?(
   ctx, 
   graphCanvas, 
   canvas, 
   pos
): void;

Defined in: packages/core/src/LGraphNode.ts:2885

Parameters ​

ctx ​

CanvasRenderingContext2D

graphCanvas ​

LGraphCanvas

canvas ​

HTMLCanvasElement

pos ​

Vector2

Returns ​

void


onDrawCollapsed()? ​

ts
onDrawCollapsed?(ctx, graphCanvas): boolean;

Defined in: packages/core/src/LGraphNode.ts:2898

Parameters ​

ctx ​

CanvasRenderingContext2D

graphCanvas ​

LGraphCanvas

Returns ​

boolean


onDrawForeground()? ​

ts
onDrawForeground?(
   ctx, 
   graphCanvas, 
   canvas
): void;

Defined in: packages/core/src/LGraphNode.ts:2892

Parameters ​

ctx ​

CanvasRenderingContext2D

graphCanvas ​

LGraphCanvas

canvas ​

HTMLCanvasElement

Returns ​

void


onDrawTitle()? ​

ts
onDrawTitle?(ctx, graphCanvas): boolean;

Defined in: packages/core/src/LGraphNode.ts:2930

Parameters ​

ctx ​

CanvasRenderingContext2D

graphCanvas ​

LGraphCanvas

Returns ​

boolean


onDrawTitleBar()? ​

ts
onDrawTitleBar?(
   ctx, 
   graphCanvas, 
   title_height, 
   size, 
   scale, 
   fgColor
): boolean;

Defined in: packages/core/src/LGraphNode.ts:2903

Parameters ​

ctx ​

CanvasRenderingContext2D

graphCanvas ​

LGraphCanvas

title_height ​

number

size ​

Vector2

scale ​

number

fgColor ​

string

Returns ​

boolean


onDrawTitleBox()? ​

ts
onDrawTitleBox?(
   ctx, 
   graphCanvas, 
   title_height, 
   size, 
   scale
): boolean;

Defined in: packages/core/src/LGraphNode.ts:2912

Parameters ​

ctx ​

CanvasRenderingContext2D

graphCanvas ​

LGraphCanvas

title_height ​

number

size ​

Vector2

scale ​

number

Returns ​

boolean


onDrawTitleText()? ​

ts
onDrawTitleText?(
   ctx, 
   graphCanvas, 
   title_height, 
   size, 
   scale, 
   font, 
   selected
): boolean;

Defined in: packages/core/src/LGraphNode.ts:2920

Parameters ​

ctx ​

CanvasRenderingContext2D

graphCanvas ​

LGraphCanvas

title_height ​

number

size ​

Vector2

scale ​

number

font ​

string

selected ​

boolean

Returns ​

boolean


onDropData()? ​

ts
onDropData?(
   data, 
   filename, 
   file
): void;

Defined in: packages/core/src/LGraphNode.ts:233

Parameters ​

data ​

string | ArrayBuffer

filename ​

string

file ​

File

Returns ​

void


onDropFile()? ​

ts
onDropFile?(file): void;

Defined in: packages/core/src/LGraphNode.ts:232

Parameters ​

file ​

File

Returns ​

void


onDropItem()? ​

ts
onDropItem?(e): boolean | void;

Defined in: packages/core/src/LGraphNode.ts:234

Parameters ​

e ​

DragEvent

Returns ​

boolean | void


onExecute()? ​

ts
onExecute?(param, options): void;

Defined in: packages/core/src/LGraphNode.ts:2989

Called by LGraph.runStep LGraphNode.getInputData

Parameters ​

param ​

any

options ​

object

Returns ​

void


onGetPropertyInfo()? ​

ts
onGetPropertyInfo?(property): IPropertyInfo;

Defined in: packages/core/src/LGraphNode.ts:3082

Parameters ​

property ​

string

Returns ​

IPropertyInfo


onInputAdded()? ​

ts
onInputAdded?(input): void;

Defined in: packages/core/src/LGraphNode.ts:3093

Parameters ​

input ​

INodeInputSlot

Returns ​

void


onInputClick()? ​

ts
onInputClick?(slot, event): void;

Defined in: packages/core/src/LGraphNode.ts:3097

Parameters ​

slot ​

number

event ​

MouseEventExt

Returns ​

void


onInputDblClick()? ​

ts
onInputDblClick?(slot, event): void;

Defined in: packages/core/src/LGraphNode.ts:3099

Parameters ​

slot ​

number

event ​

MouseEventExt

Returns ​

void


onInputRemoved()? ​

ts
onInputRemoved?(slot, input): void;

Defined in: packages/core/src/LGraphNode.ts:3095

Parameters ​

slot ​

number

input ​

INodeInputSlot

Returns ​

void


onJSPropertyChanged()? ​

ts
onJSPropertyChanged?(
   property, 
   value, 
   prevValue?
): boolean | void;

Defined in: packages/core/src/LGraphNode.ts:3080

Called when the node's title or other JS property changes

Parameters ​

property ​

string

value ​

any

prevValue? ​

any

Returns ​

boolean | void


onKey()? ​

ts
onKey?(
   event, 
   pos, 
   graphCanvas
): void;

Defined in: packages/core/src/LGraphNode.ts:2975

Parameters ​

event ​

KeyboardEvent

pos ​

Vector2

graphCanvas ​

LGraphCanvas

Returns ​

void


onKeyDown()? ​

ts
onKeyDown?(event): void;

Defined in: packages/core/src/LGraphNode.ts:2976

Parameters ​

event ​

KeyboardEvent

Returns ​

void


onKeyUp()? ​

ts
onKeyUp?(event): void;

Defined in: packages/core/src/LGraphNode.ts:2977

Parameters ​

event ​

KeyboardEvent

Returns ​

void


onMenuNodeInputs()? ​

ts
onMenuNodeInputs?(item): ContextMenuItem[];

Defined in: packages/core/src/LGraphNode.ts:3089

Parameters ​

item ​

ContextMenuItem[]

Returns ​

ContextMenuItem[]


onMenuNodeOutputs()? ​

ts
onMenuNodeOutputs?(item): ContextMenuItem[];

Defined in: packages/core/src/LGraphNode.ts:3101

Parameters ​

item ​

ContextMenuItem[]

Returns ​

ContextMenuItem[]


onMouseDown()? ​

ts
onMouseDown?(
   event, 
   pos, 
   graphCanvas
): boolean | void;

Defined in: packages/core/src/LGraphNode.ts:2939

Parameters ​

event ​

MouseEventExt

pos ​

Vector2

graphCanvas ​

LGraphCanvas

Returns ​

boolean | void


onMouseEnter()? ​

ts
onMouseEnter?(
   event, 
   pos, 
   graphCanvas
): void;

Defined in: packages/core/src/LGraphNode.ts:2957

Parameters ​

event ​

MouseEventExt

pos ​

Vector2

graphCanvas ​

LGraphCanvas

Returns ​

void


onMouseLeave()? ​

ts
onMouseLeave?(
   event, 
   pos, 
   graphCanvas
): void;

Defined in: packages/core/src/LGraphNode.ts:2963

Parameters ​

event ​

MouseEventExt

pos ​

Vector2

graphCanvas ​

LGraphCanvas

Returns ​

void


onMouseMove()? ​

ts
onMouseMove?(
   event, 
   pos, 
   graphCanvas
): void;

Defined in: packages/core/src/LGraphNode.ts:2945

Parameters ​

event ​

MouseEventExt

pos ​

Vector2

graphCanvas ​

LGraphCanvas

Returns ​

void


onMouseUp()? ​

ts
onMouseUp?(
   event, 
   pos, 
   graphCanvas
): void;

Defined in: packages/core/src/LGraphNode.ts:2951

Parameters ​

event ​

MouseEventExt

pos ​

Vector2

graphCanvas ​

LGraphCanvas

Returns ​

void


onNodeCreated()? ​

ts
onNodeCreated?(): void;

Defined in: packages/core/src/LGraphNode.ts:230

Returns ​

void


onNodeOptionalInputAdd()? ​

ts
onNodeOptionalInputAdd?(value): void;

Defined in: packages/core/src/LGraphNode.ts:3091

Parameters ​

value ​

any

Returns ​

void


onNodeOptionalOutputAdd()? ​

ts
onNodeOptionalOutputAdd?(value): void;

Defined in: packages/core/src/LGraphNode.ts:3103

Parameters ​

value ​

any

Returns ​

void


onOutputAdded()? ​

ts
onOutputAdded?(output): void;

Defined in: packages/core/src/LGraphNode.ts:3107

Parameters ​

output ​

INodeOutputSlot

Returns ​

void


onOutputClick()? ​

ts
onOutputClick?(slot, event): void;

Defined in: packages/core/src/LGraphNode.ts:3111

Parameters ​

slot ​

number

event ​

MouseEventExt

Returns ​

void


onOutputDblClick()? ​

ts
onOutputDblClick?(slot, event): void;

Defined in: packages/core/src/LGraphNode.ts:3113

Parameters ​

slot ​

number

event ​

MouseEventExt

Returns ​

void


onOutputRemoved()? ​

ts
onOutputRemoved?(slot, output): void;

Defined in: packages/core/src/LGraphNode.ts:3109

Parameters ​

slot ​

number

output ​

INodeOutputSlot

Returns ​

void


onPropertyChanged()? ​

ts
onPropertyChanged?(
   property, 
   value, 
   prevValue?
): boolean | void;

Defined in: packages/core/src/LGraphNode.ts:3075

if returns false, will abort the LGraphNode.setProperty Called when a property is changed

Parameters ​

property ​

string

value ​

any

prevValue? ​

any

Returns ​

boolean | void


onReassignID()? ​

ts
onReassignID?(idMap): void;

Defined in: packages/core/src/LGraphNode.ts:3121

Parameters ​

idMap ​

GraphIDMapping

Returns ​

void


onRemoved()? ​

ts
onRemoved?(options?): void;

Defined in: packages/core/src/LGraphNode.ts:3009

when removed from graph Called by LGraph.remove LGraph.clear

Parameters ​

options? ​

LGraphRemoveNodeOptions

Returns ​

void


onResize()? ​

ts
onResize?(size): void;

Defined in: packages/core/src/LGraphNode.ts:2979

Parameters ​

size ​

Vector2

Returns ​

void


onSelected()? ​

ts
onSelected?(): void;

Defined in: packages/core/src/LGraphNode.ts:2983

Called by LGraphCanvas.selectNodes

Returns ​

void


onSerialize()? ​

ts
onSerialize?(o): void;

Defined in: packages/core/src/LGraphNode.ts:2994

Called by LGraph.serialize

Parameters ​

o ​

SerializedLGraphNode

Returns ​

void


onShowCustomPanelInfo()? ​

ts
onShowCustomPanelInfo?(panel): void;

Defined in: packages/core/src/LGraphNode.ts:3085

Parameters ​

panel ​

INodePanel

Returns ​

void


onSlotPropertyChanged()? ​

ts
onSlotPropertyChanged?(
   kind, 
   slot, 
   slotInfo, 
   name, 
   value, 
   prev_value?
): boolean;

Defined in: packages/core/src/LGraphNode.ts:3119

Parameters ​

kind ​

LConnectionKind

slot ​

number

slotInfo ​

| INodeInputSlot | INodeOutputSlot

name ​

string

value ​

any

prev_value? ​

any

Returns ​

boolean


onWidgetChanged()? ​

ts
onWidgetChanged?(widget, oldValue?): void;

Defined in: packages/core/src/LGraphNode.ts:3087

Parameters ​

widget ​

IWidget

oldValue? ​

any

Returns ​

void


pin() ​

ts
pin(v?): void;

Defined in: packages/core/src/LGraphNode.ts:2867

Forces the node to do not move or realign on Z

Parameters ​

v? ​

boolean

Returns ​

void


removeInput() ​

ts
removeInput(slot): void;

Defined in: packages/core/src/LGraphNode.ts:1498

remove an existing input slot

Parameters ​

slot ​

number

Returns ​

void


removeOutput() ​

ts
removeOutput(slot): void;

Defined in: packages/core/src/LGraphNode.ts:1393

remove an existing output slot

Parameters ​

slot ​

number

Returns ​

void


serialize() ​

ts
serialize(): SerializedLGraphNode;

Defined in: packages/core/src/LGraphNode.ts:336

serialize the content

Returns ​

SerializedLGraphNode


setDirtyCanvas() ​

ts
setDirtyCanvas(fg, bg?): void;

Defined in: packages/core/src/LGraphNode.ts:2805

Forces to redraw or the main canvas (LGraphNode) or the bg canvas (links)

Parameters ​

fg ​

boolean

bg? ​

boolean = false

Returns ​

void


setInputDataType() ​

ts
setInputDataType(slot, type): void;

Defined in: packages/core/src/LGraphNode.ts:853

sets the input data type

Parameters ​

slot ​

number

type ​

SlotType

Returns ​

void


setInputSlotProperty() ​

ts
setInputSlotProperty(
   slot, 
   name, 
   value
): void;

Defined in: packages/core/src/LGraphNode.ts:539

Parameters ​

slot ​

number

name ​

string

value ​

any

Returns ​

void


setOutputData() ​

ts
setOutputData(slot, data): void;

Defined in: packages/core/src/LGraphNode.ts:602

sets the output data

Parameters ​

slot ​

number

data ​

any

Returns ​

void


setOutputDataType() ​

ts
setOutputDataType(slot, type): void;

Defined in: packages/core/src/LGraphNode.ts:640

sets the output data

Parameters ​

slot ​

number

type ​

SlotType

Returns ​

void


setOutputSlotProperty() ​

ts
setOutputSlotProperty(
   slot, 
   name, 
   value
): void;

Defined in: packages/core/src/LGraphNode.ts:570

Parameters ​

slot ​

number

name ​

string

value ​

any

Returns ​

void


setProperty() ​

ts
setProperty(name, value): void;

Defined in: packages/core/src/LGraphNode.ts:476

sets the value of a property

Parameters ​

name ​

string

value ​

any

Returns ​

void


setSize() ​

ts
setSize(size): void;

Defined in: packages/core/src/LGraphNode.ts:1309

changes node size and triggers callback

Parameters ​

size ​

Vector2

Returns ​

void

Method ​

setSize


setWidgetHidden() ​

ts
setWidgetHidden(widget, hidden): void;

Defined in: packages/core/src/LGraphNode.ts:1771

Parameters ​

widget ​

IWidget

hidden ​

boolean

Returns ​

void


toString() ​

ts
toString(): string;

Defined in: packages/core/src/LGraphNode.ts:446

serialize and stringify

Returns ​

string


trace() ​

ts
trace(msg): void;

Defined in: packages/core/src/LGraphNode.ts:2790

Console output

Parameters ​

msg ​

string

Returns ​

void


trigger() ​

ts
trigger(
   action, 
   param?, 
   options?
): void;

Defined in: packages/core/src/LGraphNode.ts:1171

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

Parameters ​

action ​

string

param? ​

any

options? ​

LActionOptions

Returns ​

void


triggerSlot() ​

ts
triggerSlot(
   slot, 
   param?, 
   link_id?, 
   options?
): void;

Defined in: packages/core/src/LGraphNode.ts:1193

Triggers an slot event in this node

Parameters ​

slot ​

number

the index of the output slot

param? ​

any

LinkID

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

options? ​

LActionOptions = {}

Returns ​

void


updateOutputData()? ​

ts
updateOutputData?(slot): void;

Defined in: packages/core/src/LGraphNode.ts:3105

Parameters ​

slot ​

number

Returns ​

void

Released under the MIT License.