Skip to content

Commit

Permalink
Update direct use of window
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBCarter committed Jul 22, 2024
1 parent 516e20c commit 238e640
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ export interface XyOsClockProps {
export const XyOsClock: React.FC<XyOsClockProps> = ({ clockType, clockSize, ...props }) => {
const [date, setDate] = useState(Date.now())
useEffect(() => {
// using window to avoid conflicts with @types/node's setInterval
// see comments - https://stackoverflow.com/a/53189795/2803259
const timer = window.setInterval(() => setDate(Date.now()), 500)
const timerHandler: TimerHandler = () => setDate(Date.now())
const timer = setInterval(timerHandler, 500)
return function cleanup() {
clearInterval(timer)
}
Expand Down

0 comments on commit 238e640

Please sign in to comment.