@@ -10,23 +10,23 @@ const focusTime = 5 * 60; // 5 minutes in seconds
1010const breakTime = 5 * 60 ; // 5 minutes in seconds
1111let timeRemaining = focusTime ;
1212
13- function updateDisplay ( ) {
13+ const updateDisplay = ( ) => {
1414 const minutes = Math . floor ( timeRemaining / 60 ) ;
1515 const seconds = timeRemaining % 60 ;
1616 minutesDisplay . textContent = String ( minutes ) . padStart ( 2 , '0' ) ;
1717 secondsDisplay . textContent = String ( seconds ) . padStart ( 2 , '0' ) ;
18- }
18+ } ;
1919
20- function toggleSession ( ) {
20+ const toggleSession = ( ) => {
2121 isFocusSession = ! isFocusSession ;
2222 timeRemaining = isFocusSession ? focusTime : breakTime ;
2323 statusDisplay . textContent = isFocusSession
2424 ? 'Focus Session'
2525 : 'Break Session' ;
2626 updateDisplay ( ) ;
27- }
27+ } ;
2828
29- function startTimer ( ) {
29+ const startTimer = ( ) => {
3030 if ( timerInterval ) return ; // Prevent multiple intervals
3131 timerInterval = setInterval ( ( ) => {
3232 if ( timeRemaining > 0 ) {
@@ -38,14 +38,14 @@ function startTimer() {
3838 toggleSession ( ) ;
3939 }
4040 } , 1000 ) ;
41- }
41+ } ;
4242
43- function resetTimer ( ) {
43+ const resetTimer = ( ) => {
4444 clearInterval ( timerInterval ) ;
4545 timerInterval = null ;
4646 timeRemaining = isFocusSession ? focusTime : breakTime ;
4747 updateDisplay ( ) ;
48- }
48+ } ;
4949
5050startBtn . addEventListener ( 'click' , startTimer ) ;
5151resetBtn . addEventListener ( 'click' , resetTimer ) ;
0 commit comments