From 35c4a41d7b3dd4d151d53fa369a427dbc3de0c51 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 18 Nov 2015 20:10:46 +0000 Subject: [PATCH] Node id generation should only be done in runtime/util --- red/runtime/nodes/flows/Flow.js | 7 +------ red/runtime/nodes/registry/loader.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/red/runtime/nodes/flows/Flow.js b/red/runtime/nodes/flows/Flow.js index cc35355f3..c85495071 100644 --- a/red/runtime/nodes/flows/Flow.js +++ b/red/runtime/nodes/flows/Flow.js @@ -227,11 +227,6 @@ function Flow(global,flow) { } - -function getID() { - return (1+Math.random()*4294967295).toString(16); -} - var EnvVarPropertyRE = /^\$\((\S+)\)$/; function mapEnvVarProperties(obj,prop) { @@ -297,7 +292,7 @@ function createSubflow(sf,sfn,subflows,globalSubflows,activeNodes) { var createNodeInSubflow = function(def) { node = clone(def); - var nid = getID(); + var nid = redUtil.generateId(); node_map[node.id] = node; node._alias = node.id; node.id = nid; diff --git a/red/runtime/nodes/registry/loader.js b/red/runtime/nodes/registry/loader.js index 1dfe2906f..cf7a690df 100644 --- a/red/runtime/nodes/registry/loader.js +++ b/red/runtime/nodes/registry/loader.js @@ -238,6 +238,21 @@ function loadNodeSet(node) { if (RED.hasOwnProperty(i) && !/^(init|start|stop)$/.test(i)) { var propDescriptor = Object.getOwnPropertyDescriptor(RED,i); Object.defineProperty(red,i,propDescriptor); + if (typeof RED[i] === 'function') { + console.log(i+"()"); + } else { + for (var j in RED[i]) { + if (typeof RED[i][j] === 'function') { + console.log(i+"."+j+"()"); + } else if (typeof RED[i][j] === 'number') { + console.log(i+"."+j+" #"); + } else if (typeof RED[i][j] === 'string') { + console.log(i+"."+j+" $"); + } else { + console.log(i+"."+j+" "+typeof RED[i][j]); + } + } + } } } red["_"] = function() {