mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Fix node emitter
This commit is contained in:
		| @@ -25,7 +25,6 @@ var comms = require("../comms"); | |||||||
|  |  | ||||||
| function Node(n) { | function Node(n) { | ||||||
|     this.id = n.id; |     this.id = n.id; | ||||||
|     this._events = new EventEmitter(); |  | ||||||
|     flows.add(this); |     flows.add(this); | ||||||
|     this.type = n.type; |     this.type = n.type; | ||||||
|     if (n.name) { |     if (n.name) { | ||||||
| @@ -34,6 +33,10 @@ function Node(n) { | |||||||
|     this.wires = n.wires||[]; |     this.wires = n.wires||[]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | util.inherits(Node,EventEmitter); | ||||||
|  |  | ||||||
|  | Node.prototype._on = Node.prototype.on; | ||||||
|  |  | ||||||
| Node.prototype.on = function(event,callback) { | Node.prototype.on = function(event,callback) { | ||||||
|     var node = this; |     var node = this; | ||||||
|     if (event == "close") { |     if (event == "close") { | ||||||
| @@ -48,12 +51,9 @@ Node.prototype.on = function(event,callback) { | |||||||
|         } else { |         } else { | ||||||
|             this.close = callback; |             this.close = callback; | ||||||
|         } |         } | ||||||
|  |     } else { | ||||||
|  |         this._on(event,callback); | ||||||
|     } |     } | ||||||
|     this._events.on(event,callback); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| Node.prototype.emit = function(event,args) { |  | ||||||
|     this._events.emit(event,args); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| Node.prototype.close = function() { | Node.prototype.close = function() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user