Skip to content

Commit

Permalink
fix visibility bug
Browse files Browse the repository at this point in the history
  • Loading branch information
spider4216 committed Jan 31, 2021
1 parent b37a4ef commit 68e5dc9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jsx/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 68e5dc9

Please sign in to comment.