#

API Docs for:
Show: Inherited Protected Private Deprecated

# LiteGraph Class

Defined in: `../src/litegraph.js:18`

The Global Scope. It contains all the registered node classes.

## Constructor

### `LiteGraph`

()

Defined in `../src/litegraph.js:18`

- Index
- Methods

## Item Index

### Methods

- addNodeMethod
- createNode
- getNodeType
- getNodeType
- getNodeTypesCategories
- registerNodeType
- wrapFunctionAsNode

## Methods

### `addNodeMethod`

(

- `func`

)

Defined in `../src/litegraph.js:179`

Adds this method to all nodetypes, existing and to be created (You can add it to LGraphNode.prototype but then existing node types wont have it)

#### Parameters:

- `func` Function

### `createNode`

(

- `type`
- `name`
- `options`

)

Defined in `../src/litegraph.js:197`

Create a node of a given type with a name. The node is not attached to any graph yet.

#### Parameters:

- `type` String

  full name of the node class. p.e. "math/sin"

- `name` String

  a name to distinguish from other nodes

- `options` Object

  to set options

### `getNodeType`

(

- `type`

)
Class

Defined in `../src/litegraph.js:240`

Returns a registered node type with a given name

#### Parameters:

- `type` String

  full name of the node class. p.e. "math/sin"

#### Returns:

Class:

the node class

### `getNodeType`

(

- `category`

)
Array

Defined in `../src/litegraph.js:253`

Returns a list of node types matching one category

#### Parameters:

- `category` String

  category name

#### Returns:

Array:

array with all the node classes

### `getNodeTypesCategories`

() Array

Defined in `../src/litegraph.js:281`

Returns a list with all the node type categories

#### Returns:

Array:

array with all the names of the categories

### `registerNodeType`

(

- `type`
- `base_class`

)

Defined in `../src/litegraph.js:82`

Register a node class so it can be listed when the user wants to create a new one

#### Parameters:

- `type` String

  name of the node and path

- `base_class` Class

  class containing the structure of a node

### `wrapFunctionAsNode`

(

- `name`
- `func`
- `param_types`
- `return_type`

)

Defined in `../src/litegraph.js:149`

Create a new node type by passing a function, it wraps it with a propper class and generates inputs according to the parameters of the function. Useful to wrap simple methods that do not require properties, and that only process some input to generate an output.

#### Parameters:

- `name` String

  node name with namespace (p.e.: 'math/sum')

- `func` Function
- `param_types` Array

  [optional] an array containing the type of every parameter, otherwise parameters will accept any type

- `return_type` String

  [optional] string with the return type, otherwise it will be generic