1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| var DemoServerAdapter = (function () {
function DemoServerAdapter(clientAdapter) {
this.clientAdapter = clientAdapter;
this.users = new Array(); // adds the users in the global user list
usersTmp = new Array(); // adds the users in the global user list
$.getJSON('json-data.php', function(data) {
for (key in data){
console.log('data = ' +data[key]['name']);
console.log('data = ' +data[key]['roomId']);
console.log('data = ' +data[key]['name']);
console.log('data = ' +data[key]['email']);
console.log('data = ' +data[key]['profilPictureUrl']);
var tmpuser = new ChatUserInfo();
tmpuser.Id = data[key]['id'];
tmpuser.RoomId = data[key]['roomId'];
tmpuser.Name = data[key]['name'];
tmpuser.Email = data[key]['email'];
tmpuser.ProfilePictureUrl = data[key]['profilPictureUrl'];
tmpuser.Status = data[key]['status']; //Online ;
this.users.push(tmpuser);
}
});
// configuring rooms
var defaultRoom = new ChatRoomInfo();
defaultRoom.Id = 1;
defaultRoom.Name = "Default Room";
defaultRoom.UsersOnline = this.users.length;
this.rooms = new Array();
this.rooms.push(defaultRoom);
// configuring client to return every event to me
this.clientAdapter.onMessagesChanged(function(message) {
return function() {
};
});
} |
Partager