mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix node emitter
This commit is contained in:
parent
820ca4475d
commit
525321ec7f
@ -25,7 +25,6 @@ var comms = require("../comms");
|
||||
|
||||
function Node(n) {
|
||||
this.id = n.id;
|
||||
this._events = new EventEmitter();
|
||||
flows.add(this);
|
||||
this.type = n.type;
|
||||
if (n.name) {
|
||||
@ -34,6 +33,10 @@ function Node(n) {
|
||||
this.wires = n.wires||[];
|
||||
}
|
||||
|
||||
util.inherits(Node,EventEmitter);
|
||||
|
||||
Node.prototype._on = Node.prototype.on;
|
||||
|
||||
Node.prototype.on = function(event,callback) {
|
||||
var node = this;
|
||||
if (event == "close") {
|
||||
@ -48,12 +51,9 @@ Node.prototype.on = function(event,callback) {
|
||||
} else {
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user