Throw an error if a Function node adds an input event listener

This commit is contained in:
Nick O'Leary 2016-04-21 22:24:59 +01:00
parent 59b34c2b3f
commit 2801838ffa
2 changed files with 6 additions and 0 deletions

View File

@ -83,6 +83,9 @@ module.exports = function(RED) {
sendResults(node, id, msgs); sendResults(node, id, msgs);
}, },
on: function() { on: function() {
if (arguments[0] === "input") {
throw new Error(RED._("function.error.inputListener"));
}
node.on.apply(node, arguments); node.on.apply(node, arguments);
}, },
status: function() { status: function() {

View File

@ -141,6 +141,9 @@
"function": "Function", "function": "Function",
"outputs": "Outputs" "outputs": "Outputs"
}, },
"error": {
"inputListener":"Cannot add listener to 'input' event within Function"
},
"tip": "See the Info tab for help writing functions." "tip": "See the Info tab for help writing functions."
}, },
"template": { "template": {