Skip to content

Commit

Permalink
fix(readme): multiple typos
Browse files Browse the repository at this point in the history
  • Loading branch information
cxspxr committed Oct 23, 2022
1 parent d475cbc commit 6681381
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ const formatDate = (date: Date) => {
return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}.${date.getMilliseconds()}`;
};

const getDate = () => {
return new Date();
};

type ExtremelyPreciseClockProps = {
isTicking: boolean;
};
Expand All @@ -178,15 +182,11 @@ export const ExtremelyPreciseClock: React.FC<ExtremelyPreciseClockProps> = ({
formatDate(new Date())
);

const trackTime = useCallback(() => {
return new Date();
}, []);

const [addListener, removeListener, stop, start] = useListenOnAnimationFrame(
trackTime,
getDate,
{
/**
* optionally indicate that the trackTime function and
* optionally indicate that the getDate function and
* listeners should not be invoked until you `start()`
*/
autoStart: false,
Expand All @@ -205,10 +205,10 @@ export const ExtremelyPreciseClock: React.FC<ExtremelyPreciseClockProps> = ({

useEffect(() => {
if (isTicking) {
/* start tracking trackTime & listeners */
/* start tracking getDate & listeners */
start();
} else {
/* stop tracking trackTime & listeners */
/* stop tracking getDate & listeners */
stop();
}
}, [isTicking, start, stop]);
Expand Down Expand Up @@ -272,19 +272,19 @@ const VideoWithCurrentTime: React.FC = () => {
const animationFrames;

/* better memoized */
const trackVideoTime = useCallback(() => {
const getVideoTime = useCallback(() => {
if (videoRef.current) {
return videoRef.current.currentTime();
}
}, []);

const [addOptimizedListener, removeOptimizedListener] =
useListenOnAnimationFrame(trackVideoTime, {
useListenOnAnimationFrame(getVideoTime, {
shouldInvokeListeners: conditionallyInvokeListeners,
});

const [addNotOptimizedListener, removeNotOptimizedListener] =
useListenOnAnimationFrame(trackVideoTime, {
useListenOnAnimationFrame(getVideoTime, {
shouldInvokeListeners: alwaysInvokeListeners,
});

Expand Down

0 comments on commit 6681381

Please sign in to comment.