From 547e7a1b21857f6ecc15468c703fec5c17d02371 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 10 Oct 2019 16:35:12 +0100 Subject: [PATCH] Allow node emitted events to have multiple arguments This is fixing a regression introduced in 1.0 where a custom `Node.emit` function was added that could only handle a single argument. --- packages/node_modules/@node-red/runtime/lib/nodes/Node.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/node_modules/@node-red/runtime/lib/nodes/Node.js b/packages/node_modules/@node-red/runtime/lib/nodes/Node.js index 7d2424e18..c58fa65cc 100644 --- a/packages/node_modules/@node-red/runtime/lib/nodes/Node.js +++ b/packages/node_modules/@node-red/runtime/lib/nodes/Node.js @@ -169,20 +169,20 @@ Node.prototype._emit = Node.prototype.emit; /** * Emit an event to all registered listeners. */ -Node.prototype.emit = function(event,arg) { +Node.prototype.emit = function(event, ...args) { var node = this; if (event === "input") { // When Pluggable Message Routing arrives, this will be called from // that and will already be sync/async depending on the router. if (this._asyncDelivery) { setImmediate(function() { - node._emitInput(arg); + node._emitInput.apply(node,args); }); } else { - this._emitInput(arg); + this._emitInput.apply(this,args); } } else { - this._emit(event,arg); + this._emit.apply(this,arguments); } }