@@ -2,11 +2,9 @@ let intervalId;
22let isPaused ;
33let remainingSeconds = 0 ;
44function setAlarm ( ) {
5-
6- const pauseButton = document . getElementById ( "pause-button" ) ;
7- pauseButton . textContent = "Pause" ;
8- pauseButton . removeEventListener ( "click" , pauseCountDown )
9- pauseButton . addEventListener ( "click" , pauseCountDown ) ;
5+ // const pauseButton = document.getElementById("pause-button");
6+ // pauseButton.textContent = "Pause";
7+ // pauseButton.addEventListener("click", pauseCountDown);
108
119 const alarmSetEl = document . getElementById ( "alarmSet" ) ;
1210 const timeRemainingEl = document . getElementById ( "timeRemaining" ) ;
@@ -63,9 +61,11 @@ function pauseCountDown(e) {
6361
6462function cleanInitialState ( ) {
6563 isPaused = false ;
64+ const pauseButton = document . getElementById ( "pause-button" ) ;
65+ pauseButton . textContent = "Pause" ;
6666 clearInterval ( intervalId ) ;
6767 document . body . classList . remove ( "finish-countdown" ) ;
68- updateDisplayedTime ( 0 )
68+ updateDisplayedTime ( 0 ) ;
6969 document . getElementById ( "alarmSet" ) . value = null ;
7070 pauseAlarm ( ) ;
7171}
@@ -86,6 +86,11 @@ function finishCountDown() {
8686 clearInterval ( intervalId ) ;
8787}
8888
89+ window . addEventListener ( "load" , function ( ) {
90+ const pauseButton = document . getElementById ( "pause-button" ) ;
91+ pauseButton . addEventListener ( "click" , pauseCountDown ) ;
92+ } ) ;
93+
8994// DO NOT EDIT BELOW HERE
9095
9196var audio = new Audio ( "alarmsound.mp3" ) ;
0 commit comments