diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-08-05 21:28:20 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-08-05 21:28:20 -0400 |
| commit | 4514c2c49f0e0ec7cf9911dc254a8d20644d5def (patch) | |
| tree | b4ac5caea8dca1cdefebb8873adf9d957ce7ae2a /public/js/lib/views/room/room.js | |
| parent | 4d6b5e96fbab0602c1781a8b7c06f32aa9d56d99 (diff) | |
pushing messages into a div
Diffstat (limited to 'public/js/lib/views/room/room.js')
| -rw-r--r-- | public/js/lib/views/room/room.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/public/js/lib/views/room/room.js b/public/js/lib/views/room/room.js new file mode 100644 index 0000000..c8d7f3f --- /dev/null +++ b/public/js/lib/views/room/room.js @@ -0,0 +1,29 @@ +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.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) + }) + + } + +})
\ No newline at end of file |
