-
Notifications
You must be signed in to change notification settings - Fork 1
/
printStream.js
39 lines (33 loc) · 901 Bytes
/
printStream.js
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
// 활동 스트림 화면 출력
var socket = io();
var streams = [];
var id="";
var login_flag = 0;
var return_flag = 0;
socket.on('stream', (data) => {
login_flag = 1;
streams = [];
var s = data.data;
streams = s.split('\n');
var list = document.getElementById('notice_list');
console.log(list);
list.innerHTML='<br>';
for(var i=0; i<streams.length; i++) {
list.append(streams[i]);
list.append(document.createElement("br"));
}
})
socket.on('logout', () => {
login_flag = 0;
});
socket.on('login', (data)=> {
id = data.userId;
login_flag = 1;
});
setTimeout(() => {
if (login_flag == 0){
// console.log(document.getElementById('notice_list'));
document.getElementById('notice_list').remove();
// document.getElementById('notice_list').innerHTML = " ";
}
}, 500);