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

Method setProperty

src/LGraphNode.ts:912–932  ·  view source on GitHub ↗

* sets the value of a property * @param name * @param value

(name: string, value: TWidgetValue)

Source from the content-addressed store, hash-verified

910 * @param value
911 */
912 setProperty(name: string, value: TWidgetValue): void {
913 this.properties ||= {}
914 if (value === this.properties[name]) return
915
916 const prev_value = this.properties[name]
917 this.properties[name] = value
918 // abort change
919 if (this.onPropertyChanged?.(name, value, prev_value) === false)
920 this.properties[name] = prev_value
921
922 if (this.widgets) {
923 for (const w of this.widgets) {
924 if (!w) continue
925
926 if (w.options.property == name) {
927 w.value = value
928 break
929 }
930 }
931 }
932 }
933
934 /**
935 * sets the output data

Callers 3

fUpdateMethod · 0.80
showShowNodePanelMethod · 0.80
setValueFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected