Fix node emitter

This commit is contained in:
Nick O'Leary 2014-05-15 20:55:01 +01:00
parent 820ca4475d
commit 525321ec7f
1 changed files with 6 additions and 6 deletions

View File

@ -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() {