find out if the browser tab of the page is focused

PHOTO EMBED

Sat Feb 26 2022 02:23:44 GMT+0000 (Coordinated Universal Time)

Saved by @mboljar

const isBrowserTabFocused = () => !document.hidden;

// Example
isBrowserTabFocused(); // true
content_copyCOPY

https://madza.hashnode.dev/24-modern-es6-code-snippets-to-solve-practical-js-problems?guid