build/litegraph.js
function(type, base_class) {
            if (!base_class.prototype) {
                throw "Cannot register a simple object, it must be a class with a prototype";
            }
            base_class.type = type;

            if (LiteGraph.debug) {
                console.log("Node registered: " + type);
            }

            var categories = type.split("/");
            var classname = base_class.name;

            var pos = type.lastIndexOf("/");
            base_class.category = type.substr(0, pos);

            if (!base_class.title) {
                base_class.title = classname;
            }
            //info.name = name.substr(pos+1,name.length - pos);

            //extend class
            if (base_class.prototype) {
                //is a class
                for (var i in LGraphNode.prototype) {
                    if (!base_class.prototype[i]) {
                        base_class.prototype[i] = LGraphNode.prototype[i];
                    }
                }
            }

            Object.defineProperty(base_class.prototype, "shape", {
                set: function(v) {
                    switch (v) {
                        case "default":
                            delete this._shape;
                            break;
                        case "box":
                            this._shape = LiteGraph.BOX_SHAPE;
                            break;
                        case "round":
                            this._shape = LiteGraph.ROUND_SHAPE;
                            break;
                        case "circle":
                            this._shape = LiteGraph.CIRCLE_SHAPE;
                            break;
                        case "card":
                            this._shape = LiteGraph.CARD_SHAPE;
                            break;
                        default:
                            this._shape = v;
                    }
                },
                get: function(v) {
                    return this._shape;
                },
                enumerable: true
            });

            var prev = this.registered_node_types[type];
            this.registered_node_types[type] = base_class;
            if (base_class.constructor.name) {
                this.Nodes[classname] = base_class;
            }
            if (LiteGraph.onNodeTypeRegistered) {
                LiteGraph.onNodeTypeRegistered(type, base_class);
            }
            if (prev && LiteGraph.onNodeTypeReplaced) {
                LiteGraph.onNodeTypeReplaced(type, base_class, prev);
            }

            //warnings
            if (base_class.prototype.onPropertyChange) {
                console.warn(
                    "LiteGraph node class " +
                        type +
                        " has onPropertyChange method, it must be called onPropertyChanged with d at the end"
                );
            }

            if (base_class.supported_extensions) {
                for (var i in base_class.supported_extensions) {
                    this.node_types_by_file_extension[
                        base_class.supported_extensions[i].toLowerCase()
                    ] = base_class;
                }
            }
        }
function(type, base_class) {
            if (!base_class.prototype) {
                throw "Cannot register a simple object, it must be a class with a prototype";
            }
            base_class.type = type;

            if (LiteGraph.debug) {
                console.log("Node registered: " + type);
            }

            var categories = type.split("/");
            var classname = base_class.name;

            var pos = type.lastIndexOf("/");
            base_class.category = type.substr(0, pos);

            if (!base_class.title) {
                base_class.title = classname;
            }
            //info.name = name.substr(pos+1,name.length - pos);

            //extend class
            if (base_class.prototype) {
                //is a class
                for (var i in LGraphNode.prototype) {
                    if (!base_class.prototype[i]) {
                        base_class.prototype[i] = LGraphNode.prototype[i];
                    }
                }
            }

            Object.defineProperty(base_class.prototype, "shape", {
                set: function(v) {
                    switch (v) {
                        case "default":
                            delete this._shape;
                            break;
                        case "box":
                            this._shape = LiteGraph.BOX_SHAPE;
                            break;
                        case "round":
                            this._shape = LiteGraph.ROUND_SHAPE;
                            break;
                        case "circle":
                            this._shape = LiteGraph.CIRCLE_SHAPE;
                            break;
                        case "card":
                            this._shape = LiteGraph.CARD_SHAPE;
                            break;
                        default:
                            this._shape = v;
                    }
                },
                get: function(v) {
                    return this._shape;
                },
                enumerable: true
            });

            var prev = this.registered_node_types[type];
            this.registered_node_types[type] = base_class;
            if (base_class.constructor.name) {
                this.Nodes[classname] = base_class;
            }
            if (LiteGraph.onNodeTypeRegistered) {
                LiteGraph.onNodeTypeRegistered(type, base_class);
            }
            if (prev && LiteGraph.onNodeTypeReplaced) {
                LiteGraph.onNodeTypeReplaced(type, base_class, prev);
            }

            //warnings
            if (base_class.prototype.onPropertyChange) {
                console.warn(
                    "LiteGraph node class " +
                        type +
                        " has onPropertyChange method, it must be called onPropertyChanged with d at the end"
                );
            }

            if (base_class.supported_extensions) {
                for (var i in base_class.supported_extensions) {
                    this.node_types_by_file_extension[
                        base_class.supported_extensions[i].toLowerCase()
                    ] = base_class;
                }
            }
        }
function ( type , base_class ) { if ( ! base_class . prototype ) { throw "Cannot register a simple object, it must be a class with a prototype" ; } base_class . type = type ; if ( LiteGraph . debug ) { console . log ( "Node registered: " + type ) ; } var categories = type . split ( "/" ) ; var classname = base_class . name ; var pos = type . lastIndexOf ( "/" ) ; base_class . category = type . substr ( 0 , pos ) ; if ( ! base_class . title ) { base_class . title = classname ; } //info.name = name.substr(pos+1,name.length - pos); //extend class if ( base_class . prototype ) { //is a class for ( var i in LGraphNode . prototype ) { if ( ! base_class . prototype [ i ] ) { base_class . prototype [ i ] = LGraphNode . prototype [ i ] ; } } } Object . defineProperty ( base_class . prototype , "shape" , { set : function ( v ) { switch ( v ) { case "default" : delete this . _shape ; break ; case "box" : this . _shape = LiteGraph . BOX_SHAPE ; break ; case "round" : this . _shape = LiteGraph . ROUND_SHAPE ; break ; case "circle" : this . _shape = LiteGraph . CIRCLE_SHAPE ; break ; case "card" : this . _shape = LiteGraph . CARD_SHAPE ; break ; default : this . _shape = v ; } } , get : function ( v ) { return this . _shape ; } , enumerable : true } ) ; var prev = this . registered_node_types [ type ] ; this . registered_node_types [ type ] = base_class ; if ( base_class . constructor . name ) { this . Nodes [ classname ] = base_class ; } if ( LiteGraph . onNodeTypeRegistered ) { LiteGraph . onNodeTypeRegistered ( type , base_class ) ; } if ( prev && LiteGraph . onNodeTypeReplaced ) { LiteGraph . onNodeTypeReplaced ( type , base_class , prev ) ; } //warnings if ( base_class . prototype . onPropertyChange ) { console . warn ( "LiteGraph node class " + type + " has onPropertyChange method, it must be called onPropertyChanged with d at the end" ) ; } if ( base_class . supported_extensions ) { for ( var i in base_class . supported_extensions ) { this . node_types_by_file_extension [ base_class . supported_extensions [ i ] . toLowerCase ( ) ] = base_class ; } } }
used to add extra features to the search box 
Register a node class so it can be listed when the user wants to create a new one
@method registerNodeType
@param {String} type name of the node and path
@param {Class} base_class class containing the structure of a node
used to add extra features to the search box Register a node class so it can be listed when the user wants to create a new one