Last active
December 29, 2016 22:08
-
-
Save vrcosta/e1364abcad330b43007ac82dca42befc to your computer and use it in GitHub Desktop.
PageVisibility API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('visibilitychange', function(e) { | |
document.title = "vascocosta.net | " + document.visibilityState; | |
if (document.visibilityState === "visible") { | |
startXHR(); | |
} else { | |
stopXHR(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment