Skip to content

@gausszhou/litegraph-core / LGraph

Class: LGraph ​

Defined in: packages/core/src/LGraph.ts:70

Constructors ​

Constructor ​

ts
new LGraph(o?): LGraph;

Defined in: packages/core/src/LGraph.ts:74

Parameters ​

o? ​

SerializedLGraph<SerializedLGraphNode<LGraphNode>, SerializedLLink, SerializedLGraphGroup>

Returns ​

LGraph

Properties ​

_groups ​

ts
_groups: LGraphGroup[] = [];

Defined in: packages/core/src/LGraph.ts:110


_is_subgraph ​

ts
_is_subgraph: boolean = false;

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


_last_trigger_time ​

ts
_last_trigger_time: number = 0;

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


_nodes ​

ts
_nodes: LGraphNode[] = [];

Defined in: packages/core/src/LGraph.ts:109


_nodes_by_id ​

ts
_nodes_by_id: Record<NodeID, LGraphNode> = {};

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


_nodes_executable ​

ts
_nodes_executable: 
  | LGraphNodeExecutable[]
  | null = null;

Defined in: packages/core/src/LGraph.ts:113

nodes that are executable sorted in execution order


_nodes_in_order ​

ts
_nodes_in_order: LGraphNode[] = [];

Defined in: packages/core/src/LGraph.ts:117

nodes that contain onExecute


_subgraph_node ​

ts
_subgraph_node: Subgraph | null = null;

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


_version ​

ts
_version: number = -1;

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

used to detect changes


catch_errors ​

ts
catch_errors: boolean;

Defined in: packages/core/src/LGraph.ts:87


config ​

ts
config: LGraphConfig;

Defined in: packages/core/src/LGraph.ts:89

custom data


elapsed_time ​

ts
elapsed_time: number;

Defined in: packages/core/src/LGraph.ts:93


errors_in_execution ​

ts
errors_in_execution: boolean = false;

Defined in: packages/core/src/LGraph.ts:130


execution_time ​

ts
execution_time: number = 0;

Defined in: packages/core/src/LGraph.ts:129


execution_timer_id ​

ts
execution_timer_id: number = -1;

Defined in: packages/core/src/LGraph.ts:128


extra ​

ts
extra: Record<string, any> = {};

Defined in: packages/core/src/LGraph.ts:92

to store custom data


filter ​

ts
filter: string;

Defined in: packages/core/src/LGraph.ts:86


fixedtime ​

ts
fixedtime: number;

Defined in: packages/core/src/LGraph.ts:94


fixedtime_lapse ​

ts
fixedtime_lapse: number;

Defined in: packages/core/src/LGraph.ts:95


globaltime ​

ts
globaltime: number;

Defined in: packages/core/src/LGraph.ts:96


inputs ​

ts
inputs: Record<string, LGraphInput> = {};

Defined in: packages/core/src/LGraph.ts:97


iteration ​

ts
iteration: number;

Defined in: packages/core/src/LGraph.ts:99


ts
last_link_id: number;

Defined in: packages/core/src/LGraph.ts:100


last_node_id ​

ts
last_node_id: number;

Defined in: packages/core/src/LGraph.ts:101


last_update_time ​

ts
last_update_time: number;

Defined in: packages/core/src/LGraph.ts:102


ts
links: Record<LinkID, LLink> = {};

Defined in: packages/core/src/LGraph.ts:103


list_of_graphcanvas ​

ts
list_of_graphcanvas: LGraphCanvas[] = [];

Defined in: packages/core/src/LGraph.ts:104


nodes_actioning ​

ts
nodes_actioning: Record<NodeID, string | boolean> = {};

Defined in: packages/core/src/LGraph.ts:125


nodes_executedAction ​

ts
nodes_executedAction: Record<NodeID, string> = {};

Defined in: packages/core/src/LGraph.ts:126


nodes_executing ​

ts
nodes_executing: Record<NodeID, boolean> = {};

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


outputs ​

ts
outputs: Record<string, LGraphOutput> = {};

Defined in: packages/core/src/LGraph.ts:98


runningtime ​

ts
runningtime: number;

Defined in: packages/core/src/LGraph.ts:105


starttime ​

ts
starttime: number;

Defined in: packages/core/src/LGraph.ts:106


status ​

ts
status: LGraphStatus;

Defined in: packages/core/src/LGraph.ts:107


supported_types ​

ts
supported_types: string[] | null = null;

Defined in: packages/core/src/LGraph.ts:72


vars ​

ts
vars: Record<string, any> = {};

Defined in: packages/core/src/LGraph.ts:90


DEFAULT_SUPPORTED_TYPES ​

ts
static DEFAULT_SUPPORTED_TYPES: string[];

Defined in: packages/core/src/LGraph.ts:71

Methods ​

add() ​

ts
add(node, options?): LGraphNode | null;

Defined in: packages/core/src/LGraph.ts:805

Adds a new node instance to this graph

Parameters ​

node ​

LGraphNode

the instance of the node

options? ​

LGraphAddNodeOptions = {}

Returns ​

LGraphNode | null


addGroup() ​

ts
addGroup(group): LGraphGroup;

Defined in: packages/core/src/LGraph.ts:792

Parameters ​

group ​

LGraphGroup

Returns ​

LGraphGroup


addInput() ​

ts
addInput(
   name, 
   type, 
   value?
): void;

Defined in: packages/core/src/LGraph.ts:1218

Tell this graph it has a global graph input of this type

Parameters ​

name ​

string

type ​

SlotType

value? ​

any

Returns ​

void


addOutput() ​

ts
addOutput(
   name, 
   type, 
   value
): void;

Defined in: packages/core/src/LGraph.ts:1341

Creates a global graph output

Parameters ​

name ​

string

type ​

SlotType

value ​

any

Returns ​

void


afterChange() ​

ts
afterChange(info?): void;

Defined in: packages/core/src/LGraph.ts:1471

used to resend actions, called after any change is made to the graph

Parameters ​

info? ​

LGraphNode

Returns ​

void


arrange() ​

ts
arrange(margin?, layout?): void;

Defined in: packages/core/src/LGraph.ts:616

Positions every node in a more readable manner

Parameters ​

margin? ​

number = 100

layout? ​

LayoutDirection = LayoutDirection.HORIZONTAL_LAYOUT

Returns ​

void


attachCanvas() ​

ts
attachCanvas(graphCanvas): void;

Defined in: packages/core/src/LGraph.ts:221

Attach Canvas to this graph

Parameters ​

graphCanvas ​

LGraphCanvas

Returns ​

void


beforeChange() ​

ts
beforeChange(info?): void;

Defined in: packages/core/src/LGraph.ts:1463

used for undo, called before any change is made to the graph

Parameters ​

info? ​

LGraphNode

Returns ​

void


change() ​

ts
change(): void;

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

Returns ​

void


changeInputType() ​

ts
changeInputType(name, type): boolean | undefined;

Defined in: packages/core/src/LGraph.ts:1294

Changes the type of a global graph input

Parameters ​

name ​

string

type ​

SlotType

Returns ​

boolean | undefined


changeOutputType() ​

ts
changeOutputType(name, type): boolean | undefined;

Defined in: packages/core/src/LGraph.ts:1403

Changes the type of a global graph output

Parameters ​

name ​

string

type ​

SlotType

Returns ​

boolean | undefined


checkNodeTypes() ​

ts
checkNodeTypes(): boolean;

Defined in: packages/core/src/LGraph.ts:1163

Checks that the node type matches the node type registered, used when replacing a nodetype by a newer version during execution this replaces the ones using the old version with the new version

Returns ​

boolean

Method ​

checkNodeTypes


clear() ​

ts
clear(): void;

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

Removes all nodes from this graph

Returns ​

void


clearTriggeredSlots() ​

ts
clearTriggeredSlots(): void;

Defined in: packages/core/src/LGraph.ts:1505

clears the triggered slot animation in all links (stop visual animation)

Returns ​

void


computeExecutionOrder() ​

ts
computeExecutionOrder<T>(only_onExecute?, set_level?): T[];

Defined in: packages/core/src/LGraph.ts:436

This is more internal, it computes the executable nodes in order and returns it

Type Parameters ​

T ​

T extends LGraphNode

Parameters ​

only_onExecute? ​

boolean = false

set_level? ​

any

Returns ​

T[]


computeExecutionOrderRecursive() ​

ts
computeExecutionOrderRecursive<T>(only_onExecute?, set_level?): Iterable<T>;

Defined in: packages/core/src/LGraph.ts:424

Type Parameters ​

T ​

T extends LGraphNode

Parameters ​

only_onExecute? ​

boolean = false

set_level? ​

any

Returns ​

Iterable<T>


configure() ​

ts
configure(data, keep_old?): boolean | undefined;

Defined in: packages/core/src/LGraph.ts:1604

Configure a graph from a JSON string

Parameters ​

data ​

SerializedLGraph

configure a graph from a JSON string

keep_old? ​

boolean

Returns ​

boolean | undefined

if there was any error parsing


connectionChange() ​

ts
connectionChange(node, linkInfo?): void;

Defined in: packages/core/src/LGraph.ts:1480

Parameters ​

node ​

LGraphNode

linkInfo? ​

LLink

Returns ​

void


detachCanvas() ​

ts
detachCanvas(graphCanvas): void;

Defined in: packages/core/src/LGraph.ts:238

Detach Canvas to this graph

Parameters ​

graphCanvas ​

LGraphCanvas

Returns ​

void


findNodeByTitle() ​

ts
findNodeByTitle(title): LGraphNode | null;

Defined in: packages/core/src/LGraph.ts:1093

Returns the first node that matches a name in its title

Parameters ​

title ​

string

the name of the node to search

Returns ​

LGraphNode | null

the node or null


findNodesByClass() ​

ts
findNodesByClass<T>(type, result?): T[];

Defined in: packages/core/src/LGraph.ts:1037

Returns a list of nodes that matches a class

Type Parameters ​

T ​

T extends LGraphNode

Parameters ​

type ​

new () => T

result? ​

T[] = []

Returns ​

T[]

a list with all the nodes of this type


findNodesByClassRecursive() ​

ts
findNodesByClassRecursive<T>(type, result?): T[];

Defined in: packages/core/src/LGraph.ts:1066

Returns a list of nodes that matches a class

Type Parameters ​

T ​

T extends LGraphNode

Parameters ​

type ​

new () => T

result? ​

T[] = []

Returns ​

T[]

a list with all the nodes of this type


findNodesByTitle() ​

ts
findNodesByTitle(title): LGraphNode[];

Defined in: packages/core/src/LGraph.ts:1107

Returns a list of nodes that matches a name

Parameters ​

title ​

string

the name of the node to search

Returns ​

LGraphNode[]

a list with all the nodes with this name


findNodesByType() ​

ts
findNodesByType(type, result?): LGraphNode[];

Defined in: packages/core/src/LGraph.ts:1050

Returns a list of nodes that matches a type

Parameters ​

type ​

string

the name of the node type

result? ​

LGraphNode[] = []

Returns ​

LGraphNode[]

a list with all the nodes of this type


findNodesByTypeRecursive() ​

ts
findNodesByTypeRecursive(type, result?): LGraphNode[];

Defined in: packages/core/src/LGraph.ts:1079

Returns a list of nodes that matches a type

Parameters ​

type ​

string

the name of the node type

result? ​

LGraphNode[] = []

Returns ​

LGraphNode[]

a list with all the nodes of this type


getAncestors() ​

ts
getAncestors(node): LGraphNode[];

Defined in: packages/core/src/LGraph.ts:581

Returns all the nodes that could affect this one (ancestors) by crawling all the inputs recursively. It doesn't include the node itself

Parameters ​

node ​

LGraphNode

Returns ​

LGraphNode[]

an array with all the LGraphNodes that affect this node, in order of execution


getElapsedTime() ​

ts
getElapsedTime(): number;

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

Returns the amount of time it took to compute the latest iteration. Take into account that this number could be not correct if the nodes are using graphical actions

Returns ​

number

number of milliseconds it took the last cycle


getFixedTime() ​

ts
getFixedTime(): number;

Defined in: packages/core/src/LGraph.ts:667

Returns the amount of time accumulated using the fixedtime_lapse var. This is used in context where the time increments should be constant

Returns ​

number

number of milliseconds the graph has been running


getGroupOnPos() ​

ts
getGroupOnPos(x, y): LGraphGroup | null;

Defined in: packages/core/src/LGraph.ts:1148

Returns the top-most group in that position

Parameters ​

x ​

number

the x coordinate in canvas space

y ​

number

the y coordinate in canvas space

Returns ​

LGraphGroup | null

the group or null


getInputData() ​

ts
getInputData<T>(name): T | null;

Defined in: packages/core/src/LGraph.ts:1251

Returns the current value of a global graph input

Type Parameters ​

T ​

T = any

Parameters ​

name ​

string

Returns ​

T | null


getNodeById() ​

ts
getNodeById<T>(id): T | null;

Defined in: packages/core/src/LGraph.ts:1010

Returns a node by its id.

Type Parameters ​

T ​

T extends LGraphNode = LGraphNode

Parameters ​

id ​

NodeID

Returns ​

T | null


getNodeByIdRecursive() ​

ts
getNodeByIdRecursive<T>(id): T | null;

Defined in: packages/core/src/LGraph.ts:1018

Returns a node by its id.

Type Parameters ​

T ​

T extends LGraphNode = LGraphNode

Parameters ​

id ​

NodeID

Returns ​

T | null


getNodeOnPos() ​

ts
getNodeOnPos(
   x, 
   y, 
   nodesList?, 
   margin?
): LGraphNode | null;

Defined in: packages/core/src/LGraph.ts:1124

Returns the top-most node in this position of the canvas

Parameters ​

x ​

number

the x coordinate in canvas space

y ​

number

the y coordinate in canvas space

nodesList? ​

LGraphNode[]

a list with all the nodes to search from, by default is all the nodes in the graph

margin? ​

number

Returns ​

LGraphNode | null

the node at this position or null


getOutputData() ​

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

Defined in: packages/core/src/LGraph.ts:1364

Returns the current value of a global graph output

Type Parameters ​

T ​

T = any

Parameters ​

name ​

string

Returns ​

T | null


getRootGraph() ​

ts
getRootGraph(): LGraph | null;

Defined in: packages/core/src/LGraph.ts:139

Returns ​

LGraph | null


getSupportedTypes() ​

ts
getSupportedTypes(): string[];

Defined in: packages/core/src/LGraph.ts:132

Returns ​

string[]


getTime() ​

ts
getTime(): number;

Defined in: packages/core/src/LGraph.ts:658

Returns the amount of time the graph has been running in milliseconds

Returns ​

number

number of milliseconds the graph has been running


isLive() ​

ts
isLive(): boolean;

Defined in: packages/core/src/LGraph.ts:1490

returns if the graph is in live mode

Returns ​

boolean


iterateNodesInOrder() ​

ts
iterateNodesInOrder(): Iterable<LGraphNode>;

Defined in: packages/core/src/LGraph.ts:684

Iterates all nodes in this graph excluding subgraphs.

Returns ​

Iterable<LGraphNode>


iterateNodesInOrderRecursive() ​

ts
iterateNodesInOrderRecursive(): Iterable<LGraphNode>;

Defined in: packages/core/src/LGraph.ts:694

Iterates all nodes in this graph and subgraphs.

Returns ​

Iterable<LGraphNode>


iterateNodesOfClass() ​

ts
iterateNodesOfClass<T>(ctor): Iterable<T>;

Defined in: packages/core/src/LGraph.ts:709

Iterates all nodes in this graph excluding subgraphs.

Type Parameters ​

T ​

T extends LGraphNode

Parameters ​

ctor ​

new () => T

Returns ​

Iterable<T>


iterateNodesOfClassRecursive() ​

ts
iterateNodesOfClassRecursive<T>(ctor): Iterable<T>;

Defined in: packages/core/src/LGraph.ts:723

Iterates all nodes in this graph excluding subgraphs.

Type Parameters ​

T ​

T extends LGraphNode

Parameters ​

ctor ​

new () => T

Returns ​

Iterable<T>


iterateNodesOfTypeRecursive() ​

ts
iterateNodesOfTypeRecursive<T>(type): Iterable<T>;

Defined in: packages/core/src/LGraph.ts:737

Iterates all nodes in this graph excluding subgraphs.

Type Parameters ​

T ​

T extends LGraphNode

Parameters ​

type ​

string

Returns ​

Iterable<T>


iterateParentGraphs() ​

ts
iterateParentGraphs(): Iterable<LGraph>;

Defined in: packages/core/src/LGraph.ts:147

Returns ​

Iterable<LGraph>


load() ​

ts
load(url, callback?): void;

Defined in: packages/core/src/LGraph.ts:1695

Parameters ​

url ​

string

callback? ​

(data) => void

Returns ​

void


onAction() ​

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

Defined in: packages/core/src/LGraph.ts:1191

Parameters ​

action ​

any

param ​

any

options? ​
action_call? ​

string

Returns ​

void


onAfterChange()? ​

ts
onAfterChange?(graph, info): void;

Defined in: packages/core/src/LGraph.ts:882

Called after the graph is changed

Parameters ​

graph ​

LGraph

info ​

any

Returns ​

void


onAfterExecute()? ​

ts
onAfterExecute?(): void;

Defined in: packages/core/src/LGraph.ts:901

Returns ​

void


onAfterStep()? ​

ts
onAfterStep?(): void;

Defined in: packages/core/src/LGraph.ts:899

Returns ​

void


onBeforeChange()? ​

ts
onBeforeChange?(graph, info): void;

Defined in: packages/core/src/LGraph.ts:877

Called before the graph is changed

Parameters ​

graph ​

LGraph

info ​

any

Returns ​

void


onBeforeStep()? ​

ts
onBeforeStep?(): void;

Defined in: packages/core/src/LGraph.ts:898

Returns ​

void


onChange()? ​

ts
onChange?(graph): void;

Defined in: packages/core/src/LGraph.ts:1517

Parameters ​

graph ​

LGraph

Returns ​

void


onConfigure()? ​

ts
onConfigure?(data): void;

Defined in: packages/core/src/LGraph.ts:917

Called by LGraph.configure

Parameters ​

data ​

SerializedLGraph

Returns ​

void


onConnectionChange()? ​

ts
onConnectionChange?(node): void;

Defined in: packages/core/src/LGraph.ts:1478

Parameters ​

node ​

LGraphNode

Returns ​

void


onExecuteStep()? ​

ts
onExecuteStep?(): void;

Defined in: packages/core/src/LGraph.ts:900

Returns ​

void


onGetLinkMenuOptions()? ​

ts
onGetLinkMenuOptions?(options, link): ContextMenuItem[];

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

Parameters ​

options ​

ContextMenuItem[]

LLink

Returns ​

ContextMenuItem[]


onGetNodeMenuOptions()? ​

ts
onGetNodeMenuOptions?(options, node): ContextMenuItem[];

Defined in: packages/core/src/LGraph.ts:903

Parameters ​

options ​

ContextMenuItem[]

node ​

LGraphNode

Returns ​

ContextMenuItem[]


onInputAdded()? ​

ts
onInputAdded?(
   name, 
   type, 
   value
): void;

Defined in: packages/core/src/LGraph.ts:1239

Parameters ​

name ​

string

type ​

SlotType

value ​

any

Returns ​

void


onInputRemoved()? ​

ts
onInputRemoved?(name): void;

Defined in: packages/core/src/LGraph.ts:1317

Parameters ​

name ​

string

Returns ​

void


onInputRenamed()? ​

ts
onInputRenamed?(oldName, newName): void;

Defined in: packages/core/src/LGraph.ts:1259

Parameters ​

oldName ​

string

newName ​

string

Returns ​

void


onInputsOutputsChange()? ​

ts
onInputsOutputsChange?(): void;

Defined in: packages/core/src/LGraph.ts:1203

Returns ​

void


onInputTypeChanged()? ​

ts
onInputTypeChanged?(
   name, 
   oldType, 
   newType
): void;

Defined in: packages/core/src/LGraph.ts:1291

Parameters ​

name ​

string

oldType ​

SlotType

newType ​

SlotType

Returns ​

void


onNodeAdded()? ​

ts
onNodeAdded?(node, options): void;

Defined in: packages/core/src/LGraph.ts:888

Called when a new node is added

Parameters ​

node ​

LGraphNode

the instance of the node

options ​

LGraphAddNodeOptions

Returns ​

void


onNodeConnectionChange()? ​

ts
onNodeConnectionChange?(
   kind, 
   node, 
   slot, 
   target_node?, 
   target_slot?
): void;

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

Called when a node's connection is changed

Parameters ​

kind ​

LConnectionKind

node ​

LGraphNode

the instance of the node

slot ​

number

target_node? ​

LGraphNode

target_slot? ​

number

Returns ​

void


onNodeRemoved()? ​

ts
onNodeRemoved?(node, options): void;

Defined in: packages/core/src/LGraph.ts:894

Called when a node is removed

Parameters ​

node ​

LGraphNode

the instance of the node

options ​

LGraphRemoveNodeOptions

Returns ​

void


onNodeTrace()? ​

ts
onNodeTrace?(node, message): void;

Defined in: packages/core/src/LGraph.ts:919

Parameters ​

node ​

LGraphNode

message ​

string

Returns ​

void


onOutputAdded()? ​

ts
onOutputAdded?(
   name, 
   type, 
   value
): void;

Defined in: packages/core/src/LGraph.ts:1338

Parameters ​

name ​

string

type ​

SlotType

value ​

any

Returns ​

void


onOutputRemoved()? ​

ts
onOutputRemoved?(name): void;

Defined in: packages/core/src/LGraph.ts:1426

Parameters ​

name ​

string

Returns ​

void


onOutputRenamed()? ​

ts
onOutputRenamed?(oldName, newName): void;

Defined in: packages/core/src/LGraph.ts:1372

Parameters ​

oldName ​

string

newName ​

string

Returns ​

void


onOutputTypeChanged()? ​

ts
onOutputTypeChanged?(
   name, 
   oldType, 
   newType
): void;

Defined in: packages/core/src/LGraph.ts:1400

Parameters ​

name ​

string

oldType ​

SlotType

newType ​

SlotType

Returns ​

void


onPlayEvent()? ​

ts
onPlayEvent?(): void;

Defined in: packages/core/src/LGraph.ts:896

Returns ​

void


onSerialize()? ​

ts
onSerialize?(data): void;

Defined in: packages/core/src/LGraph.ts:1546

Parameters ​

data ​

SerializedLGraph

Returns ​

void


onStopEvent()? ​

ts
onStopEvent?(): void;

Defined in: packages/core/src/LGraph.ts:897

Returns ​

void


onTrigger()? ​

ts
onTrigger?(action, param): void;

Defined in: packages/core/src/LGraph.ts:1202

Parameters ​

action ​

any

param ​

any

Returns ​

void


remove() ​

ts
remove(node, options?): void;

Defined in: packages/core/src/LGraph.ts:922

Removes a node from the graph

Parameters ​

node ​

LGraphNode

options? ​

LGraphRemoveNodeOptions = {}

Returns ​

void


removeInput() ​

ts
removeInput(name): boolean;

Defined in: packages/core/src/LGraph.ts:1320

Removes a global graph input

Parameters ​

name ​

string

Returns ​

boolean


ts
removeLink(linkId): void;

Defined in: packages/core/src/LGraph.ts:1535

Destroys a link

Parameters ​

linkId ​

LinkID

Returns ​

void


removeOutput() ​

ts
removeOutput(name): boolean;

Defined in: packages/core/src/LGraph.ts:1429

Removes a global graph output

Parameters ​

name ​

string

Returns ​

boolean


renameInput() ​

ts
renameInput(old_name, name): boolean | undefined;

Defined in: packages/core/src/LGraph.ts:1262

Changes the name of a global graph input

Parameters ​

old_name ​

string

name ​

string

Returns ​

boolean | undefined


renameOutput() ​

ts
renameOutput(old_name, name): boolean | undefined;

Defined in: packages/core/src/LGraph.ts:1375

Renames a global graph output

Parameters ​

old_name ​

string

name ​

string

Returns ​

boolean | undefined


runStep() ​

ts
runStep(
   num?, 
   do_not_catch_errors?, 
   limit?
): void;

Defined in: packages/core/src/LGraph.ts:327

Run N steps (cycles) of the graph

Parameters ​

num? ​

number = 1

number of steps to run, default is 1

do_not_catch_errors? ​

boolean = false

if you want to try/catch errors

limit? ​

number

Returns ​

void


sendActionToCanvas() ​

ts
sendActionToCanvas(action, params?): void;

Defined in: packages/core/src/LGraph.ts:778

Parameters ​

action ​

any

params? ​

any[] = []

Returns ​

void


sendEventToAllNodes() ​

ts
sendEventToAllNodes(
   eventName, 
   params?, 
   mode?
): void;

Defined in: packages/core/src/LGraph.ts:749

Sends an event to all the nodes, useful to trigger stuff

Parameters ​

eventName ​

string

the name of the event (function to be called)

params? ​

any[] = []

parameters in array format

mode? ​

NodeMode = NodeMode.ALWAYS

Returns ​

void


serialize() ​

ts
serialize<T>(): T;

Defined in: packages/core/src/LGraph.ts:1549

Creates a Object containing all the info about this graph, it can be serialized

Type Parameters ​

T ​

T extends SerializedLGraph<SerializedLGraphNode<LGraphNode>, SerializedLLink, SerializedLGraphGroup>

Returns ​

T


setDirtyCanvas() ​

ts
setDirtyCanvas(fg?, bg?): void;

Defined in: packages/core/src/LGraph.ts:1530

Parameters ​

fg? ​

boolean = false

bg? ​

boolean = false

Returns ​

void


setInputData() ​

ts
setInputData(name, data): void;

Defined in: packages/core/src/LGraph.ts:1242

Assign a data to the global graph input

Parameters ​

name ​

string

data ​

any

Returns ​

void


setOutputData() ​

ts
setOutputData(name, value): void;

Defined in: packages/core/src/LGraph.ts:1355

Assign a data to the global output

Parameters ​

name ​

string

value ​

string

Returns ​

void


start() ​

ts
start(interval?): void;

Defined in: packages/core/src/LGraph.ts:255

Starts running this graph every interval milliseconds.

Parameters ​

interval? ​

number

amount of milliseconds between executions, if 0 then it renders to the monitor refresh rate

Returns ​

void


stop() ​

ts
stop(): void;

Defined in: packages/core/src/LGraph.ts:301

Stops the execution loop of the graph

Returns ​

void


trigger() ​

ts
trigger(action, param): void;

Defined in: packages/core/src/LGraph.ts:1205

Parameters ​

action ​

any

param ​

any

Returns ​

void


triggerSlot() ​

ts
triggerSlot(action, param): void;

Defined in: packages/core/src/LGraph.ts:1211

Parameters ​

action ​

any

param ​

any

Returns ​

void


updateExecutionOrder() ​

ts
updateExecutionOrder(): void;

Defined in: packages/core/src/LGraph.ts:413

Updates the graph execution order according to relevance of the nodes (nodes with only outputs have more relevance than nodes with only inputs.

Returns ​

void

Released under the MIT License.