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

Method addOutput

src/LGraphNode.ts:1485–1505  ·  view source on GitHub ↗

* add a new output slot to use in this node * @param type string defining the output type ("vec3","number",...) * @param extra_info this can be used to have special properties of an output (label, special color, position, etc)

(
    name: string,
    type: ISlotType,
    extra_info?: TProperties,
  )

Source from the content-addressed store, hash-verified

1483 * @param extra_info this can be used to have special properties of an output (label, special color, position, etc)
1484 */
1485 addOutput<TProperties extends Partial<INodeOutputSlot>>(
1486 name: string,
1487 type: ISlotType,
1488 extra_info?: TProperties,
1489 ): INodeOutputSlot & TProperties {
1490 const output = Object.assign(
1491 new NodeOutputSlot({ name, type, links: null }, this),
1492 extra_info,
1493 )
1494
1495 this.outputs ||= []
1496 this.outputs.push(output)
1497 this.onOutputAdded?.(output)
1498
1499 if (LiteGraph.auto_load_slot_types)
1500 LiteGraph.registerNodeAndSlotType(this, type, true)
1501
1502 this.expandToFitContent()
1503 this.setDirtyCanvas(true, true)
1504 return output
1505 }
1506
1507 /**
1508 * remove an existing output slot

Calls 3

expandToFitContentMethod · 0.95
setDirtyCanvasMethod · 0.95

Tested by 1

createNodeWithWidgetFunction · 0.76