diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js index 89a9eaaa8..3a948e268 100644 --- a/editor/js/ui/editor.js +++ b/editor/js/ui/editor.js @@ -230,7 +230,7 @@ RED.editor = (function() { newValue = input.val(); } if (newValue != null) { - if (editing_node[d].toString() != newValue.toString()) { + if (editing_node[d] != newValue) { if (editing_node._def.defaults[d].type) { if (newValue == "_ADD_") { newValue = ""; diff --git a/nodes/core/core/80-function.html b/nodes/core/core/80-function.html index 91a5afee2..3ec147de8 100644 --- a/nodes/core/core/80-function.html +++ b/nodes/core/core/80-function.html @@ -22,7 +22,7 @@
- +
@@ -74,7 +74,7 @@ name: {value:""}, func: {value:"\nreturn msg;"}, outputs: {value:1}, - valid: {value:true,required:true} + noerr: {value:0,required:true,validate:function(v){ return ((!v) || (v === 0)) ? true : false; }} }, inputs:1, outputs:1, @@ -130,12 +130,13 @@ }, oneditsave: function() { var annot = this.editor.getSession().getAnnotations(); - this.valid = true; + this.noerr = 0; + $("#node-input-noerr").val(0); for (var k=0; k < annot.length; k++) { //console.log(annot[k].type,":",annot[k].text, "on line", annot[k].row); if (annot[k].type === "error") { - $("#node-input-valid").val(false); - this.valid = false; + $("#node-input-noerr").val(annot.length); + this.noerr = annot.length; } } $("#node-input-func").val(this.editor.getValue()); diff --git a/nodes/core/core/80-function.js b/nodes/core/core/80-function.js index c33907358..d8e480d84 100644 --- a/nodes/core/core/80-function.js +++ b/nodes/core/core/80-function.js @@ -19,7 +19,6 @@ module.exports = function(RED) { var util = require("util"); var vm = require("vm"); - function sendResults(node,_msgid,msgs) { if (msgs == null) { return; @@ -43,9 +42,8 @@ module.exports = function(RED) { if (msgCount>0) { node.send(msgs); } - } - + function FunctionNode(n) { RED.nodes.createNode(this,n); var node = this; @@ -99,7 +97,7 @@ module.exports = function(RED) { context.msg = msg; this.script.runInContext(context); sendResults(this,msg._msgid,context.results); - + var duration = process.hrtime(start); var converted = Math.floor((duration[0]* 1e9 + duration[1])/10000)/100; this.metric("duration", msg, converted); @@ -126,7 +124,6 @@ module.exports = function(RED) { this.error(err); } } - RED.nodes.registerType("function",FunctionNode); RED.library.register("functions"); }