Class Index | File Index

Classes


Class User

Represents an individual user connected to the now server. Exposed as the context in which group.now functions are called, as well as the context in which the callback to nowjs.getClient is executed. Each user has the User#now and User#user namespaces.
Defined in: user.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
User()
Field Summary
Field Attributes Field Name and Description
 
The user's Socket.IO socket.
Method Summary
Method Attributes Method Name and Description
 
getGroups(callback)
Used to retrieve a list of the group names corresponding to all groups the user is in.
Class Detail
User()
See:
Group#addUser
Group#removeUser
nowjs#getClient
Field Detail
{Socket} socket
The user's Socket.IO socket.
Method Detail
getGroups(callback)
Used to retrieve a list of the group names corresponding to all groups the user is in.
everyone.now.broadcast = function (message) {
var name = this.now.name;
this.getGroups(function (groups) {
  for (var i = groups.length; i--;) {
    if (groups[i] !== 'everyone') {
      nowjs.getGroup(groups[i]).now.receive(name, message);
    }
  }
});
Parameters:
{Function} callback
Called with an Array of Strings corresponding to the various group names.

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 25 2011 14:03:02 GMT-0700 (PDT)