MCPcopy Create free account
hub / github.com/Comfy-Org/litegraph.js / LGraph

Class LGraph

src/LGraph.ts:79–1936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 * + onNodeRemoved: when a node inside this graph is removed
78 */
79export class LGraph implements LinkNetwork, BaseLGraph, Serialisable<SerialisableGraph> {
80 static serialisedSchemaVersion = 1 as const
81
82 static STATUS_STOPPED = 1
83 static STATUS_RUNNING = 2
84
85 /** List of LGraph properties that are manually handled by {@link LGraph.configure}. */
86 static readonly ConfigureProperties = new Set([
87 "nodes",
88 "groups",
89 "links",
90 "state",
91 "reroutes",
92 "floatingLinks",
93 "id",
94 "subgraphs",
95 "definitions",
96 "inputs",
97 "outputs",
98 "widgets",
99 "inputNode",
100 "outputNode",
101 "extra",
102 ])
103
104 id: UUID = zeroUuid
105 revision: number = 0
106
107 _version: number = -1
108 /** The backing store for links. Keys are wrapped in String() */
109 _links: Map<LinkId, LLink> = new Map()
110 /**
111 * Indexed property access is deprecated.
112 * Backwards compatibility with a Proxy has been added, but will eventually be removed.
113 *
114 * Use {@link Map} methods:
115 * ```
116 * const linkId = 123
117 * const link = graph.links.get(linkId)
118 * // Deprecated: const link = graph.links[linkId]
119 * ```
120 */
121 links: Map<LinkId, LLink> & Record<LinkId, LLink>
122 list_of_graphcanvas: LGraphCanvas[] | null
123 status: number = LGraph.STATUS_STOPPED
124
125 state: LGraphState = {
126 lastGroupId: 0,
127 lastNodeId: 0,
128 lastLinkId: 0,
129 lastRerouteId: 0,
130 }
131
132 readonly events = new CustomEventTarget<LGraphEventMap>()
133 readonly _subgraphs: Map<UUID, Subgraph> = new Map()
134
135 _nodes: (LGraphNode | SubgraphNode)[] = []
136 _nodes_by_id: Record<NodeId, LGraphNode> = {}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected