@@ -10,17 +10,18 @@ let driving = false;
1010// set up your syncDiff function using updateUsers as a callback
1111
1212const startButton = document . querySelector ( '.start-button' )
13- startButton . addEventListener ( 'click' , e => {
13+ startButton . addEventListener ( 'click' , event => {
1414 driving = true ;
1515 // send 'start_pointing' message to the channel here
1616} )
1717
18- const nextCardButtons = document . getElementsByClassName ( 'next-card' )
19- for ( let i = 0 ; i < nextCardButtons . length ; i ++ ) {
20- nextCardButtons [ i ] . addEventListener ( 'click' , e => {
18+ document
19+ . querySelectorAll ( '.next-card' )
20+ . forEach ( elem => {
21+ elem . addEventListener ( 'click' , event => {
2122 // send 'finalized_points' message to the channel here
23+ } )
2224 } )
23- }
2425
2526document
2627 . querySelector ( '.calculate-points' )
@@ -34,7 +35,7 @@ document
3435// 'winner'
3536// 'tie'
3637
37- function showCard ( state ) {
38+ const showCard = state => {
3839 document
3940 . querySelector ( '.start-button' )
4041 . style . display = "none"
@@ -58,7 +59,7 @@ function showCard(state) {
5859 . innerHTML = state . card . description
5960}
6061
61- function showWinner ( state ) {
62+ const showWinner = state => {
6263 document
6364 . querySelector ( '.winner' )
6465 . style . display = "block"
@@ -76,7 +77,7 @@ function showWinner(state) {
7677 . disabled = ! driving
7778}
7879
79- function showTie ( state ) {
80+ const showTie = state => {
8081 document
8182 . querySelector ( '.tie' )
8283 . style . display = "block"
0 commit comments