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

Method addProperty

src/LGraphNode.ts:1464–1478  ·  view source on GitHub ↗

* add a new property to this node * @param type string defining the output type ("vec3","number",...) * @param extra_info this can be used to have special properties of the property (like values, etc)

(
    name: string,
    default_value: NodeProperty | undefined,
    type?: string,
    extra_info?: Partial<INodePropertyInfo>,
  )

Source from the content-addressed store, hash-verified

1462 * @param extra_info this can be used to have special properties of the property (like values, etc)
1463 */
1464 addProperty(
1465 name: string,
1466 default_value: NodeProperty | undefined,
1467 type?: string,
1468 extra_info?: Partial<INodePropertyInfo>,
1469 ): INodePropertyInfo {
1470 const o: INodePropertyInfo = { name, type, default_value }
1471 if (extra_info) Object.assign(o, extra_info)
1472
1473 this.properties_info ||= []
1474 this.properties_info.push(o)
1475 this.properties ||= {}
1476 this.properties[name] = default_value
1477 return o
1478 }
1479
1480 /**
1481 * add a new output slot to use in this node

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected