Skip to content

Commit

Permalink
iOS: prevent location change when page is hidden
Browse files Browse the repository at this point in the history
based on suggestion in richtr/NoSleep.js#25
  • Loading branch information
Udo Giacomozzi committed Nov 29, 2016
1 parent 415f7fe commit ae28aff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ios.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ let WakeLockIOS = React.createClass({
if (preventSleep && !this.timer) {

this.timer = setInterval(() => {
location.href = '/';
setTimeout(window.stop, 0);

if (!document.hidden) { // gh-richtr/NoSleep.js#25
location.href = '/';
setTimeout(window.stop, 0);
}

}, 15000);

Expand Down

0 comments on commit ae28aff

Please sign in to comment.