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