2015-06-10 16:12:52 +00:00
|
|
|
var Connections = (function(){
|
|
|
|
var Connections = function(){
|
|
|
|
if(!(this instanceof Connections)){
|
|
|
|
return (new Connections());
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* constructor here
|
|
|
|
*/
|
|
|
|
this._connections = {};
|
2015-06-18 14:54:44 +00:00
|
|
|
this.roomCollection = {};
|
2015-06-10 16:12:52 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
var r = Connections.prototype;
|
|
|
|
/**
|
|
|
|
* methods && properties here
|
|
|
|
* r.property = null;
|
|
|
|
* r.getProperty = function() {...}
|
|
|
|
*/
|
|
|
|
|
|
|
|
r._connections = null;
|
2015-06-18 14:54:44 +00:00
|
|
|
r.roomCollection = null;
|
2015-06-10 16:12:52 +00:00
|
|
|
|
|
|
|
r.add = function(user) {
|
|
|
|
this._connections[user.getID()] = user;
|
|
|
|
}
|
|
|
|
|
|
|
|
r.remove = function(user) {
|
|
|
|
delete this._connections[user.getID()];
|
|
|
|
}
|
|
|
|
|
|
|
|
r.get = function() {
|
|
|
|
return this._connections;
|
|
|
|
}
|
|
|
|
|
2015-06-13 07:58:55 +00:00
|
|
|
r.hasUser = function(user) {
|
|
|
|
return !!this._connections[user.getID()];
|
|
|
|
}
|
|
|
|
|
2015-06-10 16:12:52 +00:00
|
|
|
|
|
|
|
return Connections;
|
|
|
|
})();
|
|
|
|
|
|
|
|
module.exports = Connections;
|