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

Method connectByType

src/LGraphNode.ts:2435–2452  ·  view source on GitHub ↗

* connect this node output to the input of another node BY TYPE * @param slot (could be the number of the slot or the string with the name of the slot) * @param target_node the target node * @param target_slotType the input slot type of the target node * @returns the link_info is created

(
    slot: number | string,
    target_node: LGraphNode,
    target_slotType: ISlotType,
    optsIn?: ConnectByTypeOptions,
  )

Source from the content-addressed store, hash-verified

2433 * @returns the link_info is created, otherwise null
2434 */
2435 connectByType(
2436 slot: number | string,
2437 target_node: LGraphNode,
2438 target_slotType: ISlotType,
2439 optsIn?: ConnectByTypeOptions,
2440 ): LLink | null {
2441 const slotIndex = this.findConnectByTypeSlot(
2442 true,
2443 target_node,
2444 target_slotType,
2445 optsIn,
2446 )
2447 if (slotIndex !== undefined)
2448 return this.connect(slot, target_node, slotIndex, optsIn?.afterRerouteId)
2449
2450 console.debug("[connectByType]: no way to connect type:", target_slotType, "to node:", target_node)
2451 return null
2452 }
2453
2454 /**
2455 * connect this node input to the output of another node BY TYPE

Callers 4

SubgraphIO.test.tsFile · 0.45
inner_clickedMethod · 0.45
selectMethod · 0.45

Calls 2

findConnectByTypeSlotMethod · 0.95
connectMethod · 0.95

Tested by

no test coverage detected