blob: f8b632450adf7f5f2bdf2179c678ed1c00254d8a (
plain)
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
|
var RoomView = View.extend({
events: {
},
initialize: function(name){
app.socket = ws.connect(name)
var base = this
this.name = name
this.chat = new ChatView (app.socket)
this.userlist = new UserlistView (app.socket)
this.settings = new SettingsView (app.socket)
app.socket.emit("join", { nick: user.username })
app.socket.on("welcome", function(room){
console.log(room)
room.messages.forEach(base.chat.add)
base.userlist.users = room.users
base.userlist.update()
base.settings.update(room.settings)
})
app.socket.on("message", function(msg){
base.chat.add(msg)
})
}
})
|