File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -95,15 +95,19 @@ class Stopwatch {
95
95
96
96
stopTimer ( ) {
97
97
if ( this . state != Stopwatch . states . STOPPED ) {
98
- this . state = Stopwatch . states . STOPPED ;
99
98
clearInterval ( this . intervalTimer ) ;
100
99
clearInterval ( this . pauseTimerInterval ) ;
101
- const time = this . calculateTime ( ) ;
100
+ this . totalPausedTime += this . currentPausedTime ;
101
+
102
+ const time = this . state == Stopwatch . states . PAUSED ? this . timeUi . textContent : this . calculateTime ( ) ;
102
103
this . lastTimeUi . textContent = `Last time: ${ time } ` ;
104
+
103
105
this . totalPausedTime = this . currentPausedTime = 0 ;
104
106
this . pausedTimeStart = 0 ;
107
+
105
108
this . timeUi . textContent = '00:00:00' ;
106
109
110
+ this . state = Stopwatch . states . STOPPED ;
107
111
this . historyResults . push ( time ) ;
108
112
this . fillArchiveUi ( ) ;
109
113
}
You can’t perform that action at this time.
0 commit comments