@@ -37,6 +37,7 @@ function MyTimer({ expiryTimestamp }) {
37
37
minutes ,
38
38
hours ,
39
39
days ,
40
+ isRunning ,
40
41
start ,
41
42
pause ,
42
43
resume ,
@@ -51,6 +52,7 @@ function MyTimer({ expiryTimestamp }) {
51
52
< div style= {{fontSize: ' 100px' }}>
52
53
< span> {days}< / span> : < span> {hours}< / span> : < span> {minutes}< / span> : < span> {seconds}< / span>
53
54
< / div>
55
+ < p> {isRunning ? ' Running' : ' Not running' }< / p>
54
56
< button onClick= {start}> Start< / button>
55
57
< button onClick= {pause}> Pause< / button>
56
58
< button onClick= {resume}> Resume< / button>
@@ -90,6 +92,7 @@ export default function App() {
90
92
| minutes | number | minutes value |
91
93
| hours | number | hours value |
92
94
| days | number | days value |
95
+ | isRunning | boolean | flag to indicate if timer is running or not |
93
96
| pause | function | function to be called to pause timer |
94
97
| start | function | function if called after pause the timer will continue based on original expiryTimestamp |
95
98
| resume | function | function if called after pause the timer will continue countdown from last paused state |
@@ -112,6 +115,7 @@ function MyStopwatch() {
112
115
minutes ,
113
116
hours ,
114
117
days ,
118
+ isRunning ,
115
119
start ,
116
120
pause ,
117
121
reset ,
@@ -125,6 +129,7 @@ function MyStopwatch() {
125
129
< div style= {{fontSize: ' 100px' }}>
126
130
< span> {days}< / span> : < span> {hours}< / span> : < span> {minutes}< / span> : < span> {seconds}< / span>
127
131
< / div>
132
+ < p> {isRunning ? ' Running' : ' Not running' }< / p>
128
133
< button onClick= {start}> Start< / button>
129
134
< button onClick= {pause}> Pause< / button>
130
135
< button onClick= {reset}> Reset< / button>
@@ -155,6 +160,7 @@ export default function App() {
155
160
| minutes | number | minutes value |
156
161
| hours | number | hours value |
157
162
| days | number | days value |
163
+ | isRunning | boolean | flag to indicate if stopwatch is running or not |
158
164
| start | function | function to be called to start/resume stopwatch |
159
165
| pause | function | function to be called to pause stopwatch |
160
166
| reset | function | function to be called to reset stopwatch to 0:0:0:0 |
0 commit comments