mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Throw an error if a Function node adds an input event listener
This commit is contained in:
		@@ -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() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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": {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user