Skip to content

Instantly share code, notes, and snippets.

@fhdalikhan
Last active March 28, 2019 10:57
Show Gist options
  • Save fhdalikhan/62d3894c5b56d0c696bff09c2fb40c5a to your computer and use it in GitHub Desktop.
Save fhdalikhan/62d3894c5b56d0c696bff09c2fb40c5a to your computer and use it in GitHub Desktop.
Hook into the page's visible event, for e.g. if a page tab goes into backgroud or if a page tab becomes active
document.addEventListener("visibilitychange", function() {
console.log( document.visibilityState );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment