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

Method createSubgraph

src/LGraph.ts:1389–1398  ·  view source on GitHub ↗

* Creates a new subgraph definition, and adds it to the graph. * @param data Exported data (typically serialised) to configure the new subgraph with * @returns The newly created subgraph definition.

(data: ExportedSubgraph)

Source from the content-addressed store, hash-verified

1387 * @returns The newly created subgraph definition.
1388 */
1389 createSubgraph(data: ExportedSubgraph): Subgraph {
1390 const { id } = data
1391
1392 const subgraph = new Subgraph(this.rootGraph, data)
1393 this.subgraphs.set(id, subgraph)
1394
1395 // FE: Create node defs
1396 this.rootGraph.events.dispatch("subgraph-created", { subgraph, data })
1397 return subgraph
1398 }
1399
1400 convertToSubgraph(items: Set<Positionable>): { subgraph: Subgraph, node: SubgraphNode } {
1401 if (items.size === 0) throw new Error("Cannot convert to subgraph: nothing to convert")

Callers 4

convertToSubgraphMethod · 0.95
configureMethod · 0.95
#processPrimaryButtonMethod · 0.80
_pasteFromClipboardMethod · 0.80

Calls 2

setMethod · 0.80
dispatchMethod · 0.65

Tested by

no test coverage detected