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';
22import { Time } from './utils' ;
33import { useInterval } from './hooks' ;
44
5- export default function useStopwatch ( { autoStart, offsetTimestamp } ) {
5+ export default function useStopwatch ( { autoStart, offsetTimestamp } = { } ) {
66 const [ passedSeconds , setPassedSeconds ] = useState ( Time . getSecondsFromExpiry ( offsetTimestamp , true ) || 0 ) ;
77 const [ prevTime , setPrevTime ] = useState ( new Date ( ) ) ;
88 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';
22import { Time } from './utils' ;
33import { useInterval } from './hooks' ;
44
5- export default function useTime ( { format } ) {
5+ export default function useTime ( { format } = { } ) {
66 const [ seconds , setSeconds ] = useState ( Time . getSecondsFromTimeNow ( ) ) ;
77
88 useInterval ( ( ) => {
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ function getDelayFromExpiryTimestamp(expiryTimestamp) {
1313 return extraMilliSeconds > 0 ? extraMilliSeconds : DEFAULT_DELAY ;
1414}
1515
16- export default function useTimer ( { expiryTimestamp : expiry , onExpire, autoStart = true } ) {
16+ export default function useTimer ( { expiryTimestamp : expiry , onExpire, autoStart = true } = { } ) {
1717 const [ expiryTimestamp , setExpiryTimestamp ] = useState ( expiry ) ;
1818 const [ seconds , setSeconds ] = useState ( Time . getSecondsFromExpiry ( expiryTimestamp ) ) ;
1919 const [ isRunning , setIsRunning ] = useState ( autoStart ) ;
You can’t perform that action at this time.
0 commit comments