Skip to content

Commit

Permalink
Implementação do alerta de cheer (#12)
Browse files Browse the repository at this point in the history
Closes #2
  • Loading branch information
narcello committed Jan 25, 2022
1 parent fe5c33f commit be75da1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion assets/alerts.html
Expand Up @@ -22,7 +22,7 @@
<script src="/socket.io/socket.io.js"></script>

<script>
function appendAlertWithAnimation(element, duration = 8000){
function appendAlertWithAnimation(element, duration = 8000) {
alertsList.append(element);

window.requestAnimationFrame(() => {
Expand Down Expand Up @@ -66,6 +66,14 @@
appendAlertWithAnimation(resubBox)
});
});

socket.on('cheer', function(msg) {
const cheerBox = createAlertBox(`Obrigado pelos ${msg.bits} bits ${msg.username}!!!`);

window.requestAnimationFrame(() => {
appendAlertWithAnimation(cheerBox)
});
});
</script>
</body>
</html>

0 comments on commit be75da1

Please sign in to comment.