1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Node id generation should only be done in runtime/util

This commit is contained in:
Nick O'Leary 2015-11-18 20:10:46 +00:00
parent 1ca3ca07d5
commit 35c4a41d7b
2 changed files with 16 additions and 6 deletions

View File

@ -227,11 +227,6 @@ function Flow(global,flow) {
} }
function getID() {
return (1+Math.random()*4294967295).toString(16);
}
var EnvVarPropertyRE = /^\$\((\S+)\)$/; var EnvVarPropertyRE = /^\$\((\S+)\)$/;
function mapEnvVarProperties(obj,prop) { function mapEnvVarProperties(obj,prop) {
@ -297,7 +292,7 @@ function createSubflow(sf,sfn,subflows,globalSubflows,activeNodes) {
var createNodeInSubflow = function(def) { var createNodeInSubflow = function(def) {
node = clone(def); node = clone(def);
var nid = getID(); var nid = redUtil.generateId();
node_map[node.id] = node; node_map[node.id] = node;
node._alias = node.id; node._alias = node.id;
node.id = nid; node.id = nid;

View File

@ -238,6 +238,21 @@ function loadNodeSet(node) {
if (RED.hasOwnProperty(i) && !/^(init|start|stop)$/.test(i)) { if (RED.hasOwnProperty(i) && !/^(init|start|stop)$/.test(i)) {
var propDescriptor = Object.getOwnPropertyDescriptor(RED,i); var propDescriptor = Object.getOwnPropertyDescriptor(RED,i);
Object.defineProperty(red,i,propDescriptor); 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() { red["_"] = function() {