red/nodes/registry.js
/**
 * Loads the specified node into the runtime
 * @param node a node info object - see loadNodeConfig
 * @return a promise that resolves to an update node info object. The object
 *         has the following properties added:
 *            err: any error encountered whilst loading the node
 *            
 */
Loads the specified node into the runtime
@param node a node info object - see loadNodeConfig
@return a promise that resolves to an update node info object. The object
has the following properties added:
err: any error encountered whilst loading the node
Loads the specified node into the runtime @param node a node info object - see loadNodeConfig @return a promise that resolves to an update node info object . The object has the following properties added : err : any error encountered whilst loading the node
function loadNodeModule(node) {
    var nodeDir = path.dirname(node.file);
    var nodeFn = path.basename(node.file);
    try {
        var loadPromise = null;
        var r = require(node.file);
        if (typeof r === "function") {
            var promise = r(require('../red'));
            if (promise != null && typeof promise.then === "function") {
                loadPromise = promise.then(function() {
                    node.enabled = true;
                    return node;
                }).otherwise(function(err) {
                    node.err = err;
                    node.enabled = false;
                    return node;
                });
            }
        }
        if (loadPromise == null) {
            node.enabled = true;
            loadPromise = when.resolve(node);
        }
        return loadPromise;
    } catch(err) {
        node.err = err;
        node.enabled = false;
        return when.resolve(node);
    }
}
function loadNodeModule ( node ) { var nodeDir = path . dirname ( node . file ) ; var nodeFn = path . basename ( node . file ) ; try { var loadPromise = null ; var r = require ( node . file ) ; if ( typeof r === "function" ) { var promise = r ( require ( '../red' ) ) ; if ( promise != null && typeof promise . then === "function" ) { loadPromise = promise . then ( function ( ) { node . enabled = true ; return node ; } ) . otherwise ( function ( err ) { node . err = err ; node . enabled = false ; return node ; } ) ; } } if ( loadPromise == null ) { node . enabled = true ; loadPromise = when . resolve ( node ) ; } return loadPromise ; } catch ( err ) { node . err = err ; node . enabled = false ; return when . resolve ( node ) ; } }
Loads the specified node into the runtime
 @param node a node info object - see loadNodeConfig
 @return a promise that resolves to an update node info object.
Loads the specified node into the runtime @param node a node info object - see loadNodeConfig @return a promise that resolves to an update node info object .