Skip to content

Commit 15d7c32

Browse files
committed
update readme with isRunning flag
1 parent c659d7f commit 15d7c32

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function MyTimer({ expiryTimestamp }) {
4141
pause,
4242
resume,
4343
restart,
44+
isRunning,
4445
} = useTimer({ expiryTimestamp, onExpire: () => console.warn('onExpire called') });
4546

4647

@@ -60,6 +61,7 @@ function MyTimer({ expiryTimestamp }) {
6061
time.setSeconds(time.getSeconds() + 300);
6162
restart(time)
6263
}}>Restart</button>
64+
<p>{isRunning ? 'Running' : 'Not running'}</p>
6365
</div>
6466
);
6567
}
@@ -94,6 +96,7 @@ export default function App() {
9496
| start | function | function if called after pause the timer will continue based on original expiryTimestamp |
9597
| resume | function | function if called after pause the timer will continue countdown from last paused state |
9698
| restart | function | function to restart timer with new expiryTimestamp |
99+
| isRunning | boolean | flag to indicate if timer is running or not |
97100

98101

99102
---
@@ -115,6 +118,7 @@ function MyStopwatch() {
115118
start,
116119
pause,
117120
reset,
121+
isRunning,
118122
} = useStopwatch({ autoStart: true });
119123

120124

@@ -128,6 +132,7 @@ function MyStopwatch() {
128132
<button onClick={start}>Start</button>
129133
<button onClick={pause}>Pause</button>
130134
<button onClick={reset}>Reset</button>
135+
<p>{isRunning ? 'Running' : 'Not running'}</p>
131136
</div>
132137
);
133138
}
@@ -158,6 +163,7 @@ export default function App() {
158163
| start | function | function to be called to start/resume stopwatch |
159164
| pause | function | function to be called to pause stopwatch |
160165
| 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 |
161167

162168

163169
---

0 commit comments

Comments
 (0)