-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.js
More file actions
executable file
·40 lines (38 loc) · 1.08 KB
/
Copy pathutils.js
File metadata and controls
executable file
·40 lines (38 loc) · 1.08 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
exports.getImacHostName = () => {
if (process.env.NODE_ENV === 'development') {
console.log('imac-dev');
return 'imac-dev';
}
if (process.argv[2] === '--demo') {
console.log('imac-dev');
return 'imac-dev';
}
console.log('imac-dev');
return 'imac-dev';
}
exports.getWebcamStatus = memStore => {
const webcamStatus = [
'authorized',
['liveBroadcastId', 'videoId'],
['OBSWebSocketConnected', 'obsReady'],
['OBSWebSocketAuthenticated', 'obsAuthReady'],
'streaming'
]
.reduce((a, e) => {
if (typeof e === 'string') return {...a, [e]: memStore[e]}
if (typeof e === 'object') return {...a, [e[1]]: memStore[e[0]]}
}, {});
return webcamStatus;
}
exports.wait = (sec, io) => {
let counter = sec;
io.of('webcam').emit('waitCounter', counter);
const interval = setInterval(() => {
io.of('webcam').emit('waitCounter', counter - 1);
counter = counter - 1;
}, 1000)
return new Promise(resolve => setTimeout(() => {
clearInterval(interval);
return resolve();
}, sec * 1000));
}