socket.io-hotel
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -33,3 +33,3 @@ _ = require('underscore') | ||
Hotel.prototype.delEmptyRoom = function(roomID, clbk) { | ||
if(_.isEmpty(this.adapter.rooms[roomID])){ | ||
if(!this.adapter.rooms[roomID][roomID]){ | ||
delete this.adapter.rooms[roomID] | ||
@@ -36,0 +36,0 @@ delete this.adapter.rooms_props[roomID]; |
{ | ||
"name": "socket.io-hotel", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "socket.io-hotel is a manager that adds new features and functionalities to socket.io's rooms", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -12,3 +12,4 @@ ##socket.io-hotel | ||
```javascript | ||
io = require('socket.io')(http) | ||
io = require('socket.io')(http), | ||
Hotel = require('socket.io-hotel') | ||
//... | ||
@@ -20,22 +21,20 @@ var hotel = new Hotel(io.sockets.adapter) | ||
--- | ||
`setPropertyRoom(roomID, key, val, clbk)` | ||
####setPropertyRoom(roomID, key, val, clbk) | ||
sets a new property [val: key] to the room . clbk receives an object with the rooms' properties modified | ||
`delRoomProperty(roomID, key, clbk)` | ||
####delRoomProperty(roomID, key, clbk) | ||
deletes a specific property from the room. callback receives an object with the rooms' properties object modified | ||
`getPropertiesRoom(roomID, clbk)` | ||
####getPropertiesRoom(roomID, clbk) | ||
callback receives all properties from a give object | ||
`listRooms = function(clbk)` | ||
####listRooms = function(clbk) | ||
calback receives a list with all rooms | ||
`getUsersRoom = function(roomID, clbk)` | ||
####getUsersRoom = function(roomID, clbk) | ||
callback receives all users from a given room | ||
`delEmptyRoom = function(roomID, clbk)` | ||
####delEmptyRoom = function(roomID, clbk) | ||
if room is empty, delete it. callback returns `true` if the room was deleted and `false` otherwise | ||
`roomExists = function(roomID, clbk)` | ||
callback receives `true` if room exists. `false` otherwise |
@@ -16,4 +16,4 @@ var test = require('tape'), | ||
rooms: { | ||
room1: ['user1'], | ||
room2: ['user1', 'user2'], | ||
room1: {'room1':{room1:true}}, | ||
room2: {'room2':{room2:true}, 'room1':{room1:true}}, | ||
emptyRoom: [] | ||
@@ -57,3 +57,3 @@ }, | ||
hotel.removeRoomProperty('room1','color',function(properties){ | ||
hotel.delRoomProperty('room1','color',function(properties){ | ||
t.equal(properties.color,undefined,'color was removed from room 1'); | ||
@@ -60,0 +60,0 @@ t.equal(_.size(properties),2, 'room 1 has 2 properties') |
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
7073
39