93
How to check if the document becomes visible or hidden
2021-06-03 - JavaScript
1// JS Tip of the Day
2// How to check if the document becomes visible or hidden
3
4document.addEventListener("visibilitychange", function() {
5 console.log(document.visibilityState);
6 /*
7 You can stop or activate the UI updates or any tasks that the user doesn't want to
8 have running in the background.
9 */
10})
#JStipoftheday