Skip to content

Commit

Permalink
Use blacklist instead of internal emit function
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Kovanen committed Jun 13, 2014
1 parent f15104d commit be3f3c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function Manager(uri, opts){
Manager.prototype.propagateEvent = function() {
this.emit.apply(this, arguments);
for (var nsp in this.nsps) {
this.nsps[nsp].$emit.apply(this.nsps[nsp], arguments);
this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
}
};

Expand Down Expand Up @@ -452,5 +452,5 @@ Manager.prototype.onreconnect = function(){
var attempt = this.attempts;
this.attempts = 0;
this.reconnecting = false;
this.emit('reconnect', attempt);
this.propagateEvent('reconnect', attempt);
};
16 changes: 6 additions & 10 deletions lib/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ module.exports = exports = Socket;
var events = {
connect: 1,
disconnect: 1,
error: 1
error: 1,
reconnect: 1,
reconnect_attempt: 1,
reconnect_failed: 1,
reconnect_error: 1,
reconnecting: 1
};

/**
Expand Down Expand Up @@ -96,15 +101,6 @@ Socket.prototype.send = function(){
return this;
};

/**
* EventEmitter#emit for internal events
*
* @api private
*/
Socket.prototype.$emit = function(ev) {
emit.apply(this, arguments);
};

/**
* Override `emit`.
* If the event is in `events`, it's emitted normally.
Expand Down

0 comments on commit be3f3c4

Please sign in to comment.