mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -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); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user