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

Add status capability to function node

This commit is contained in:
Dave Conway-Jones 2015-10-15 13:33:01 +01:00
parent 4772bca14a
commit 0343de9f34

View File

@ -57,6 +57,7 @@ module.exports = function(RED) {
"error:__node__.error,"+ "error:__node__.error,"+
"warn:__node__.warn,"+ "warn:__node__.warn,"+
"on:__node__.on,"+ "on:__node__.on,"+
"status:__node__.status,"+
"send:function(msgs){ __node__.send(__msgid__,msgs);}"+ "send:function(msgs){ __node__.send(__msgid__,msgs);}"+
"};\n"+ "};\n"+
this.func+"\n"+ this.func+"\n"+
@ -81,6 +82,9 @@ module.exports = function(RED) {
}, },
on: function() { on: function() {
node.on.apply(node, arguments); node.on.apply(node, arguments);
},
status: function() {
node.status.apply(node, arguments);
} }
}, },
context: { context: {
@ -119,9 +123,9 @@ module.exports = function(RED) {
errorMessage = stack[line]; errorMessage = stack[line];
var m = /:(\d+):(\d+)$/.exec(stack[line+1]); var m = /:(\d+):(\d+)$/.exec(stack[line+1]);
if (m) { if (m) {
var line = Number(m[1])-1; var lineno = Number(m[1])-1;
var cha = m[2]; var cha = m[2];
errorMessage += " (line "+line+", col "+cha+")"; errorMessage += " (line "+lineno+", col "+cha+")";
} }
} }
} }