build/litegraph.js
function GraphInput() {
        this.addOutput("", "");

        this.name_in_graph = "";
        this.properties = {};
        var that = this;

        Object.defineProperty(this.properties, "name", {
            get: function() {
                return that.name_in_graph;
            },
            set: function(v) {
                if (v == "" || v == that.name_in_graph || v == "enabled") {
                    return;
                }
                if (that.name_in_graph) {
                    //already added
                    that.graph.renameInput(that.name_in_graph, v);
                } else {
                    that.graph.addInput(v, that.properties.type);
                }
                that.name_widget.value = v;
                that.name_in_graph = v;
            },
            enumerable: true
        });

        Object.defineProperty(this.properties, "type", {
            get: function() {
                return that.outputs[0].type;
            },
            set: function(v) {
                if (v == "event") {
                    v = LiteGraph.EVENT;
                }
                that.outputs[0].type = v;
                if (that.name_in_graph) {
                    //already added
                    that.graph.changeInputType(
                        that.name_in_graph,
                        that.outputs[0].type
                    );
                }
                that.type_widget.value = v;
            },
            enumerable: true
        });

        this.name_widget = this.addWidget(
            "text",
            "Name",
            this.properties.name,
            function(v) {
                if (!v) {
                    return;
                }
                that.properties.name = v;
            }
        );
        this.type_widget = this.addWidget(
            "text",
            "Type",
            this.properties.type,
            function(v) {
                v = v || "";
                that.properties.type = v;
            }
        );

        this.widgets_up = true;
        this.size = [180, 60];
    }
function GraphInput() {
        this.addOutput("", "");

        this.name_in_graph = "";
        this.properties = {};
        var that = this;

        Object.defineProperty(this.properties, "name", {
            get: function() {
                return that.name_in_graph;
            },
            set: function(v) {
                if (v == "" || v == that.name_in_graph || v == "enabled") {
                    return;
                }
                if (that.name_in_graph) {
                    //already added
                    that.graph.renameInput(that.name_in_graph, v);
                } else {
                    that.graph.addInput(v, that.properties.type);
                }
                that.name_widget.value = v;
                that.name_in_graph = v;
            },
            enumerable: true
        });

        Object.defineProperty(this.properties, "type", {
            get: function() {
                return that.outputs[0].type;
            },
            set: function(v) {
                if (v == "event") {
                    v = LiteGraph.EVENT;
                }
                that.outputs[0].type = v;
                if (that.name_in_graph) {
                    //already added
                    that.graph.changeInputType(
                        that.name_in_graph,
                        that.outputs[0].type
                    );
                }
                that.type_widget.value = v;
            },
            enumerable: true
        });

        this.name_widget = this.addWidget(
            "text",
            "Name",
            this.properties.name,
            function(v) {
                if (!v) {
                    return;
                }
                that.properties.name = v;
            }
        );
        this.type_widget = this.addWidget(
            "text",
            "Type",
            this.properties.type,
            function(v) {
                v = v || "";
                that.properties.type = v;
            }
        );

        this.widgets_up = true;
        this.size = [180, 60];
    }
function GraphInput ( ) { this . addOutput ( "" , "" ) ; this . name_in_graph = "" ; this . properties = { } ; var that = this ; Object . defineProperty ( this . properties , "name" , { get : function ( ) { return that . name_in_graph ; } , set : function ( v ) { if ( v == "" || v == that . name_in_graph || v == "enabled" ) { return ; } if ( that . name_in_graph ) { //already added that . graph . renameInput ( that . name_in_graph , v ) ; } else { that . graph . addInput ( v , that . properties . type ) ; } that . name_widget . value = v ; that . name_in_graph = v ; } , enumerable : true } ) ; Object . defineProperty ( this . properties , "type" , { get : function ( ) { return that . outputs [ 0 ] . type ; } , set : function ( v ) { if ( v == "event" ) { v = LiteGraph . EVENT ; } that . outputs [ 0 ] . type = v ; if ( that . name_in_graph ) { //already added that . graph . changeInputType ( that . name_in_graph , that . outputs [ 0 ] . type ) ; } that . type_widget . value = v ; } , enumerable : true } ) ; this . name_widget = this . addWidget ( "text" , "Name" , this . properties . name , function ( v ) { if ( ! v ) { return ; } that . properties . name = v ; } ) ; this . type_widget = this . addWidget ( "text" , "Type" , this . properties . type , function ( v ) { v = v || "" ; that . properties . type = v ; } ) ; this . widgets_up = true ; this . size = [ 180 , 60 ] ; }
Input for a subgraph
Input for a subgraph