Class: Env

Env()

This class represents a main global environment for cnodes. The class is a "static" class that is responible for maintaining a global registry of registered nodes. A node registration is a object with three fields: a node name, a category name and a factory, that returns a new instance for that node. The global Env instance must be initialized one-time by calling the Env.init() method, this method register all built-in nodes. Eventual custom nodes must be registered manually via Env.registerNode(name, category, factory).

Constructor

new Env()

Source:

Members

(private) nodeRegistry

The internal node registry
Source:

Methods

(static) export(program)

Creates and returns a JSON representation of the entire program
Parameters:
Name Type Description
program Program The program to export
Source:

(static) getCategories()

Return the list of unique registered categories
Source:

(static) getCategoryNodes(category)

Return an array of registrations for nodes. Registrations have the sign: {name, category, factory}
Parameters:
Name Type Description
category string The category for which seacrh registrations
Source:

(static) getInstance(name)

Instantiate a node by name
Parameters:
Name Type Description
name string The name of the node
Source:

(static) import(data)

Create a program instance based on export data created with export() method
Parameters:
Name Type Description
data any A object with the export data format
Source:

(static) init()

Initialize the CNodes global environment
Source:

(static) registerBreaker(obj, opts)

Create helper breaker nodes to support user with dealing with specific object structures. This method accepts optional options that let you specify what exactly create: { recursive: true, forceTypes: true, editableOutputs: true }
Parameters:
Name Type Description
obj any The object structure to consider whiel create nodes
opts any The options on create nodes
Source:

(static) registerMaker(obj, opts)

Create helper maker nodes to support user with dealing with specific object structures. This method accepts optional options that let you specify what exactly create: { recursive: true, fillValues: true, forceTypes: true editableInputs: true }
Parameters:
Name Type Description
obj any The object structure to consider whiel create nodes
opts any The options on create nodes
Source:

(static) registerNode(description, category, factory)

Register a node type
Parameters:
Name Type Description
description string The name of the node
category string The category of the node
factory any A function that instantiate the node
Source:

(static) registerObject(obj, opts)

Create both helper maker and breaker nodes to support user with dealing with specific object structures. This method accepts optional options that let you specify what exactly create: { recursive: true, fillValues: true, forceTypes: true, editableInputs: true editableOutputs: true }
Parameters:
Name Type Description
obj any The object structure to consider whiel create nodes
opts any The options on create nodes
Source:

(static) unregisterAllNodes()

Unregister all nodes
Source:

(static) unregisterNode(instance)

Unregister a node
Parameters:
Name Type Description
instance string The instance static function of the node
Source: