-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroomView.js
More file actions
73 lines (53 loc) · 1.48 KB
/
roomView.js
File metadata and controls
73 lines (53 loc) · 1.48 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//let the server know that the client has join
jQuery(function ($) {
var $roomID=$('#roomNum');
var $userName=$('#username');
var $usermsg=$('#usermsg');
var $link=$('#link');
var $shareableLink=$('#sharableLink');
//IO name space includes all handling of socket.io on the client side
var IO=
{
init:function()
{
IO.socket=io();
IO.bindEvents();
IO.socket.emit('joinRoom',$roomID);
}
,
bindEvents:function ()
{
IO.socket.on('joinRoom',IO.joinRoom);
IO.socket.on('createRoom',IO.createRoom);
}
,
joinRoom:function(username)
{
$usermsg.innerText=username+" has joined the room ";
}
,
createRoom:function ()
{
}
}
var App=
{
init:function()
{
App.bindEvents();
}
,
bindEvents:function()
{
$shareableLink.onclick(App.displaySharedLink);
}
,
displaySharedLink:function()
{
$link.innerText=window.location.href;
$link.hidden=false;
}
}
IO.init();
App.init();
});