Compare commits
2 Commits
5b5210d5da
...
master
Author | SHA1 | Date | |
---|---|---|---|
a18644d40e | |||
02b7708976 |
@@ -1,4 +1,4 @@
|
|||||||
FROM node:12
|
FROM node:14
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
18
room.js
18
room.js
@@ -108,9 +108,11 @@ function reset(roomId) {
|
|||||||
room.canBuzz = true;
|
room.canBuzz = true;
|
||||||
|
|
||||||
room.participants.forEach(p => {
|
room.participants.forEach(p => {
|
||||||
p.ws.send(JSON.stringify({
|
if (p.ws) {
|
||||||
type: "reset"
|
p.ws.send(JSON.stringify({
|
||||||
}));
|
type: "reset"
|
||||||
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,10 +139,12 @@ function updateScore(roomId, participantId, points) {
|
|||||||
|
|
||||||
participant.score += points;
|
participant.score += points;
|
||||||
|
|
||||||
participant.ws.send(JSON.stringify({
|
if (participant.ws) {
|
||||||
type: "score",
|
participant.ws.send(JSON.stringify({
|
||||||
score: participant.score,
|
type: "score",
|
||||||
}));
|
score: participant.score,
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
room.audience.forEach(ws => {
|
room.audience.forEach(ws => {
|
||||||
|
@@ -65,7 +65,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
function beep() {
|
function beep() {
|
||||||
window.navigator.vibrate(500);
|
if (window.navigator.vibrate) window.navigator.vibrate(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateScore(participantId, points) {
|
function updateScore(participantId, points) {
|
||||||
|
@@ -69,7 +69,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function showMessage(msg) {
|
function showMessage(msg) {
|
||||||
window.navigator.vibrate(500);
|
if (window.navigator.vibrate) window.navigator.vibrate(500);
|
||||||
document.getElementById('buzzer').disabled = true;
|
document.getElementById('buzzer').disabled = true;
|
||||||
var mb = document.getElementById('messageBox');
|
var mb = document.getElementById('messageBox');
|
||||||
mb.innerHTML = msg;
|
mb.innerHTML = msg;
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function beep() {
|
function beep() {
|
||||||
window.navigator.vibrate(500);
|
if (window.navigator.vibrate) window.navigator.vibrate(500);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
Reference in New Issue
Block a user