socket.io-adapter
Advanced tools
Comparing version 1.0.0 to 1.1.0
1.1.0 / 2017-02-26 | ||
=================== | ||
* [feat] Add addAll method (#49) | ||
1.0.0 / 2017-02-16 | ||
@@ -3,0 +8,0 @@ =================== |
24
index.js
@@ -44,6 +44,22 @@ | ||
Adapter.prototype.add = function(id, room, fn){ | ||
this.sids[id] = this.sids[id] || {}; | ||
this.sids[id][room] = true; | ||
this.rooms[room] = this.rooms[room] || Room(); | ||
this.rooms[room].add(id); | ||
return this.addAll(id, [ room ], fn); | ||
}; | ||
/** | ||
* Adds a socket to a list of room. | ||
* | ||
* @param {String} socket id | ||
* @param {String} rooms | ||
* @param {Function} callback | ||
* @api public | ||
*/ | ||
Adapter.prototype.addAll = function(id, rooms, fn){ | ||
for (var i = 0; i < rooms.length; i++) { | ||
var room = rooms[i]; | ||
this.sids[id] = this.sids[id] || {}; | ||
this.sids[id][room] = true; | ||
this.rooms[room] = this.rooms[room] || Room(); | ||
this.rooms[room].add(id); | ||
} | ||
if (fn) process.nextTick(fn.bind(null, null)); | ||
@@ -50,0 +66,0 @@ }; |
{ | ||
"name": "socket.io-adapter", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8323
229