blob: 10c4d08a160937500413c31c8d5dbe623ddbeeff (
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
|
var chat
var RoomView = View.extend({
events: {
},
initialize: function(name){
this.name = name
chat = this.chatView = new ChatView ()
this.userlist = new UserlistView ()
app.socket = ws.connect(name)
app.socket.emit("join", { nick: user.username })
app.socket.on("joined", function(msgs){
msgs && msgs.forEach(chat.add)
})
app.socket.on("messages", function(msgs){
msgs && msgs.forEach(chat.add)
})
app.socket.on("message", function(msg){
chat.add(msg)
})
}
})
|