Class SFS2X.Managers.UserManager
The manager of the local (client-side) users list.
Constructor Attributes | Constructor Name and Description |
---|---|
Creates a new UserManager instance.
|
Method Summary
Class Detail
SFS2X.Managers.UserManager(sfs)
Creates a new UserManager instance.
This class keeps track of all the users that are currently joined in the same Rooms of the current user. It also provides utility methods to look for users by name and id.
NOTE: developers never istantiate a UserManager manually: this is done by the SmartFoxServer 2X API internally. A reference to the existing instance can be retrieved using the SmartFox.userManager property.
- Parameters:
- {SmartFox} sfs
- An instance of the SmartFoxServer 2X client API main SmartFox class.
- See also:
- SFS2X.SmartFox#userManager
Method Detail
-
{Boolean} containsUser(user)Indicates whether a user exists in the local users list or not.
- Parameters:
- {SFSUser} user
- The SFSUser object representing the user whose presence in the users list is to be tested.
- Returns:
- {Boolean}
true
if the passed user exists in the users list. - See also:
- SFS2X.Entities.SFSUser
-
{Boolean} containsUserId(userId)Indicates whether a user exists in the local users list or not from the id.
- Parameters:
- {Number} userId
- The id of the user whose presence in the users list is to be tested.
- Returns:
- {Boolean}
true
if the passed user exists in the users list. - See also:
- SFS2X.Entities.SFSUser#id
-
{Boolean} containsUserName(userName)Indicates whether a user exists in the local users list or not from the name.
- Parameters:
- {String} userName
- The name of the user whose presence in the users list is to be tested.
- Returns:
- {Boolean}
true
if the passed user exists in the users list. - See also:
- SFS2X.Entities.SFSUser#name
-
{SFSUser} getUserById(userId)Retrieves a SFSUser object from its id property.
- Parameters:
- {Number} userId
- The id of the user to be found.
- Returns:
- {SFSUser} The SFSUser object representing the user, or
null
if no user with the passed id exists in the local users list. - See also:
- SFS2X.Entities.SFSUser#id
-
{SFSUser} getUserByName(userName)Retrieves a SFSUser object from its name property.
- Parameters:
- {String} userName
- The name of the user to be found.
- Returns:
- {SFSUser} The SFSUser object representing the user, or
null
if no user with the passed name exists in the local users list. - See also:
- SFS2X.Entities.SFSUser#name
-
{Number} getUserCount()Returns the total number of users in the local users list.
- Returns:
- {Number} The number of users in the local users list.
-
{Array} getUserList()Get the whole list of users inside the Rooms joined by the client.
- Returns:
- {Array} The list of SFSUser objects representing the users in the local users list.
- See also:
- SFS2X.Entities.SFSUser