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

Method connectByTypeOutput

src/LGraphNode.ts:2461–2483  ·  view source on GitHub ↗

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

(
    slot: number | string,
    source_node: LGraphNode,
    source_slotType: ISlotType,
    optsIn?: ConnectByTypeOptions,
  )

Source from the content-addressed store, hash-verified

2459 * @returns the link_info is created, otherwise null
2460 */
2461 connectByTypeOutput(
2462 slot: number | string,
2463 source_node: LGraphNode,
2464 source_slotType: ISlotType,
2465 optsIn?: ConnectByTypeOptions,
2466 ): LLink | null {
2467 // LEGACY: Old options names
2468 if (typeof optsIn === "object") {
2469 if ("firstFreeIfInputGeneralInCase" in optsIn) optsIn.wildcardToTyped = !!optsIn.firstFreeIfInputGeneralInCase
2470 if ("generalTypeInCase" in optsIn) optsIn.typedToWildcard = !!optsIn.generalTypeInCase
2471 }
2472 const slotIndex = this.findConnectByTypeSlot(
2473 false,
2474 source_node,
2475 source_slotType,
2476 optsIn,
2477 )
2478 if (slotIndex !== undefined)
2479 return source_node.connect(slotIndex, this, slot, optsIn?.afterRerouteId)
2480
2481 console.debug("[connectByType]: no way to connect type:", source_slotType, "to node:", source_node)
2482 return null
2483 }
2484
2485 canConnectTo(
2486 node: NodeLike,

Callers 3

inner_clickedMethod · 0.45
selectMethod · 0.45

Calls 2

findConnectByTypeSlotMethod · 0.95
connectMethod · 0.45

Tested by

no test coverage detected