@@ -37,11 +37,11 @@ function MyTimer({ expiryTimestamp }) {
37
37
minutes ,
38
38
hours ,
39
39
days ,
40
+ isRunning ,
40
41
start ,
41
42
pause ,
42
43
resume ,
43
44
restart ,
44
- isRunning ,
45
45
} = useTimer ({ expiryTimestamp, onExpire : () => console .warn (' onExpire called' ) });
46
46
47
47
@@ -52,6 +52,7 @@ function MyTimer({ expiryTimestamp }) {
52
52
< div style= {{fontSize: ' 100px' }}>
53
53
< span> {days}< / span> : < span> {hours}< / span> : < span> {minutes}< / span> : < span> {seconds}< / span>
54
54
< / div>
55
+ < p> {isRunning ? ' Running' : ' Not running' }< / p>
55
56
< button onClick= {start}> Start< / button>
56
57
< button onClick= {pause}> Pause< / button>
57
58
< button onClick= {resume}> Resume< / button>
@@ -61,7 +62,6 @@ function MyTimer({ expiryTimestamp }) {
61
62
time .setSeconds (time .getSeconds () + 300 );
62
63
restart (time)
63
64
}}> Restart< / button>
64
- < p> {isRunning ? ' Running' : ' Not running' }< / p>
65
65
< / div>
66
66
);
67
67
}
@@ -92,11 +92,11 @@ export default function App() {
92
92
| minutes | number | minutes value |
93
93
| hours | number | hours value |
94
94
| days | number | days value |
95
+ | isRunning | boolean | flag to indicate if timer is running or not |
95
96
| pause | function | function to be called to pause timer |
96
97
| start | function | function if called after pause the timer will continue based on original expiryTimestamp |
97
98
| resume | function | function if called after pause the timer will continue countdown from last paused state |
98
99
| restart | function | function to restart timer with new expiryTimestamp |
99
- | isRunning | boolean | flag to indicate if timer is running or not |
100
100
101
101
102
102
---
@@ -115,10 +115,10 @@ function MyStopwatch() {
115
115
minutes ,
116
116
hours ,
117
117
days ,
118
+ isRunning ,
118
119
start ,
119
120
pause ,
120
121
reset ,
121
- isRunning ,
122
122
} = useStopwatch ({ autoStart: true });
123
123
124
124
@@ -129,10 +129,10 @@ function MyStopwatch() {
129
129
< div style= {{fontSize: ' 100px' }}>
130
130
< span> {days}< / span> : < span> {hours}< / span> : < span> {minutes}< / span> : < span> {seconds}< / span>
131
131
< / div>
132
+ < p> {isRunning ? ' Running' : ' Not running' }< / p>
132
133
< button onClick= {start}> Start< / button>
133
134
< button onClick= {pause}> Pause< / button>
134
135
< button onClick= {reset}> Reset< / button>
135
- < p> {isRunning ? ' Running' : ' Not running' }< / p>
136
136
< / div>
137
137
);
138
138
}
@@ -160,10 +160,10 @@ export default function App() {
160
160
| minutes | number | minutes value |
161
161
| hours | number | hours value |
162
162
| days | number | days value |
163
+ | isRunning | boolean | flag to indicate if stopwatch is running or not |
163
164
| start | function | function to be called to start/resume stopwatch |
164
165
| pause | function | function to be called to pause stopwatch |
165
166
| reset | function | function to be called to reset stopwatch to 0:0:0:0 |
166
- | isRunning | boolean | flag to indicate if stopwatch is running or not |
167
167
168
168
169
169
---
0 commit comments