diff --git a/public/client.js b/public/client.js index 9214428..0f744c5 100644 --- a/public/client.js +++ b/public/client.js @@ -1,5 +1,6 @@ const player = io() let myNumber = 0 +let autoPlayer = 0 player.on('alert', (message) => { alert(message) @@ -34,3 +35,14 @@ function makeCards(n) { if (n == 0) return '' return '['.repeat(n) + ']' } + +buttonAuto.addEventListener('click', () => { + if (autoPlayer != 0) { + clearInterval(autoPlayer) + autoPlayer = 0 + buttonAuto.style.color = 'black' + } else { + autoPlayer = setInterval(() => player.emit('go'), 1000) + buttonAuto.style.color = 'red' + } +}) diff --git a/public/index.html b/public/index.html index 28f4f35..1c61945 100644 --- a/public/index.html +++ b/public/index.html @@ -20,6 +20,7 @@

+