Foco do usuário na guia javascript
if (document.hasFocus()) console.log('Tab is active')
emanuallan
if (document.hasFocus()) console.log('Tab is active')