mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
index: added second parameter to of optional
This commit is contained in:
@@ -177,15 +177,17 @@ Server.prototype.onconnection = function(conn){
|
||||
* Looks up a namespace.
|
||||
*
|
||||
* @param {String} nsp name
|
||||
* @param {Function} optional, nsp `connection` ev handler
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Server.prototype.of = function(name){
|
||||
Server.prototype.of = function(name, fn){
|
||||
if (!this.nsps[name]) {
|
||||
debug('initializing namespace %s', name);
|
||||
var nsp = new Namespace(this, name);
|
||||
this.nsps[name] = nsp;
|
||||
}
|
||||
if (fn) this.nsps[name].on('connect', fn);
|
||||
return this.nsps[name];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user