Constructors

Properties

Methods

Constructors

Properties

_groups: LGraphGroup[] = []
_is_subgraph: boolean = false
_last_trigger_time: number = 0
_nodes: LGraphNode[] = []
_nodes_by_id: Record<NodeID, LGraphNode> = {}
_nodes_executable: LGraphNodeExecutable[] = null

nodes that are executable sorted in execution order

_nodes_in_order: LGraphNode[] = []

nodes that contain onExecute

_subgraph_node: Subgraph = null
_version: number = -1

used to detect changes

catch_errors: boolean
config: LGraphConfig

custom data

elapsed_time: number
errors_in_execution: boolean = false
events: EventEmitter<{
    afterChange: ((graph, node) => void);
    afterExecute: (() => void);
    beforeChange: ((graph, node) => void);
    beforeStep: (() => void);
    change: ((graph) => void);
    configure: ((data) => void);
    connectionChange: ((node) => void);
    executeStep: (() => void);
    inputAdded: ((name, type, value) => void);
    inputRemoved: ((name) => void);
    inputRenamed: ((oldName, newName) => void);
    inputTypeChanged: ((name, oldType, type) => void);
    inputsOutputsChange: (() => void);
    nodeAdded: ((node, options) => void);
    nodeRemoved: ((node, options) => void);
    outputAdded: ((name, type, value) => void);
    outputRemoved: ((name) => void);
    outputRenamed: ((oldName, newName) => void);
    outputTypeChanged: ((name, oldType, type) => void);
    play: (() => void);
    serialize: ((data) => void);
    stop: (() => void);
    trigger: ((eventName, ...args) => void);
}> = ...

Type declaration

  • afterChange: ((graph, node) => void)
  • afterExecute: (() => void)
      • (): void
      • Returns void

  • beforeChange: ((graph, node) => void)
  • beforeStep: (() => void)
      • (): void
      • Returns void

  • change: ((graph) => void)
      • (graph): void
      • Parameters

        Returns void

  • configure: ((data) => void)
  • connectionChange: ((node) => void)
      • (node): void
      • Parameters

        Returns void

  • executeStep: (() => void)
      • (): void
      • Returns void

  • inputAdded: ((name, type, value) => void)
      • (name, type, value): void
      • Parameters

        Returns void

  • inputRemoved: ((name) => void)
      • (name): void
      • Parameters

        • name: string

        Returns void

  • inputRenamed: ((oldName, newName) => void)
      • (oldName, newName): void
      • Parameters

        • oldName: string
        • newName: string

        Returns void

  • inputTypeChanged: ((name, oldType, type) => void)
      • (name, oldType, type): void
      • Parameters

        Returns void

  • inputsOutputsChange: (() => void)
      • (): void
      • Returns void

  • nodeAdded: ((node, options) => void)
  • nodeRemoved: ((node, options) => void)
  • outputAdded: ((name, type, value) => void)
      • (name, type, value): void
      • Parameters

        Returns void

  • outputRemoved: ((name) => void)
      • (name): void
      • Parameters

        • name: string

        Returns void

  • outputRenamed: ((oldName, newName) => void)
      • (oldName, newName): void
      • Parameters

        • oldName: string
        • newName: string

        Returns void

  • outputTypeChanged: ((name, oldType, type) => void)
      • (name, oldType, type): void
      • Parameters

        Returns void

  • play: (() => void)
      • (): void
      • Returns void

  • serialize: ((data) => void)
  • stop: (() => void)
      • (): void
      • Returns void

  • trigger: ((eventName, ...args) => void)
      • (eventName, ...args): void
      • Parameters

        • eventName: string
        • Rest ...args: any[]

        Returns void

execution_time: number = 0
execution_timer_id: number = -1
extra: Record<string, any> = {}

to store custom data

filter: string
fixedtime: number
fixedtime_lapse: number
globaltime: number
inputs: Record<string, LGraphInput> = {}
iteration: number
last_link_id: number
last_node_id: number
last_update_time: number
links: Record<LinkID, LLink> = {}
list_of_graphcanvas: LGraphCanvas[] = []
nodes_actioning: boolean[] = []
nodes_executedAction: string[] = []
nodes_executing: boolean[] = []
outputs: Record<string, LGraphOutput> = {}
runningtime: number
starttime: number
status: LGraphStatus
supported_types: string[] = null
vars: Record<string, any> = {}
DEFAULT_SUPPORTED_TYPES: string[] = ...

Methods

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

    Parameters

    • name: string
    • type: SlotType
    • Optional value: any

    Returns void

  • 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

  • Computes the connected components of the graph.

    Returns GraphComponent[]

    • A 2D array where each sub-array represents a connected component, containing all the nodes in that component.
  • This is more internal, it computes the executable nodes in order and returns it

    Type Parameters

    Parameters

    • only_onExecute: boolean = false
    • Optional set_level: any

    Returns T[]

  • Type Parameters

    Parameters

    • only_onExecute: boolean = false
    • Optional set_level: any

    Returns Iterable<T>

  • Returns a list of nodes that matches a class

    Type Parameters

    Parameters

    • type: (new () => T)
        • new (): T
        • Returns T

    • result: T[] = []

    Returns T[]

    a list with all the nodes of this type

  • Returns a list of nodes that matches a class

    Type Parameters

    Parameters

    • type: (new () => T)
        • new (): T
        • Returns T

    • result: T[] = []

    Returns T[]

    a list with all the nodes of this type

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

    Parameters

    Returns LGraphNode[]

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

  • 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

  • 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

  • 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

    • Optional nodesList: LGraphNode[]

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

    • Optional margin: number

    Returns LGraphNode

    the node at this position or null

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

    Returns number

    number of milliseconds the graph has been running

  • Iterates all nodes in this graph excluding subgraphs.

    Type Parameters

    Parameters

    • ctor: (new () => T)
        • new (): T
        • Returns T

    Returns Iterable<T>

  • Iterates all nodes in this graph excluding subgraphs.

    Type Parameters

    Parameters

    • ctor: (new () => T)
        • new (): T
        • Returns T

    Returns Iterable<T>

  • Parameters

    • url: string | Blob
    • Optional callback: ((any) => void)
        • (any): void
        • Parameters

          • any: any

          Returns void

    Returns void

  • Parameters

    • action: any
    • param: any
    • options: {
          action_call?: string;
      } = {}
      • Optional action_call?: string

    Returns void

  • Changes the name of a global graph input

    Parameters

    • old_name: string
    • name: string

    Returns boolean

  • Renames a global graph output

    Parameters

    • old_name: string
    • name: string

    Returns boolean

  • 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

    • Optional limit: number

    Returns void

  • 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

  • Starts running this graph every interval milliseconds.

    Parameters

    • Optional interval: number

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

    Returns void

  • 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