File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { useState, useCallback } from 'react';
2
2
import { Time } from './utils' ;
3
3
import { useInterval } from './hooks' ;
4
4
5
- export default function useStopwatch ( { autoStart, offsetTimestamp } ) {
5
+ export default function useStopwatch ( { autoStart, offsetTimestamp } = { } ) {
6
6
const [ passedSeconds , setPassedSeconds ] = useState ( Time . getSecondsFromExpiry ( offsetTimestamp , true ) || 0 ) ;
7
7
const [ prevTime , setPrevTime ] = useState ( new Date ( ) ) ;
8
8
const [ seconds , setSeconds ] = useState ( passedSeconds + Time . getSecondsFromPrevTime ( prevTime || 0 , true ) ) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { useState } from 'react';
2
2
import { Time } from './utils' ;
3
3
import { useInterval } from './hooks' ;
4
4
5
- export default function useTime ( { format } ) {
5
+ export default function useTime ( { format } = { } ) {
6
6
const [ seconds , setSeconds ] = useState ( Time . getSecondsFromTimeNow ( ) ) ;
7
7
8
8
useInterval ( ( ) => {
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ function getDelayFromExpiryTimestamp(expiryTimestamp) {
13
13
return extraMilliSeconds > 0 ? extraMilliSeconds : DEFAULT_DELAY ;
14
14
}
15
15
16
- export default function useTimer ( { expiryTimestamp : expiry , onExpire, autoStart = true } ) {
16
+ export default function useTimer ( { expiryTimestamp : expiry , onExpire, autoStart = true } = { } ) {
17
17
const [ expiryTimestamp , setExpiryTimestamp ] = useState ( expiry ) ;
18
18
const [ seconds , setSeconds ] = useState ( Time . getSecondsFromExpiry ( expiryTimestamp ) ) ;
19
19
const [ isRunning , setIsRunning ] = useState ( autoStart ) ;
You can’t perform that action at this time.
0 commit comments