From 68e5dc96db8a831fd16c02882153fcfa85de4f47 Mon Sep 17 00:00:00 2001 From: Yuriy Sirotenko Date: Sun, 31 Jan 2021 21:25:55 +0600 Subject: [PATCH] fix visibility bug --- jsx/index.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jsx/index.jsx b/jsx/index.jsx index b460817..bde8f28 100644 --- a/jsx/index.jsx +++ b/jsx/index.jsx @@ -218,6 +218,8 @@ class App extends React.Component componentDidMount() { let timer = setInterval(() => { + if (document.visibilityState !== 'visible') return + this.setState({time: this.state.time - 1}); if (this.state.time <= 5 && this.state.time > 0) {