Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-20 23:02:01 +03:00
parent 52880f08ee
commit caa67e2a49
63 changed files with 175 additions and 126 deletions

View File

@ -3,9 +3,9 @@ title: isBrowserTabFocused
tags: browser,beginner
---
Returns `true` if the browser tab of the page is focused, `false` otherwise.
Checks if the browser tab of the page is focused.
- Use the `Document.hidden` property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.
- Use the `Document.hidden` property, introduced by the [Page Visibility API](https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API) to check if the browser tab of the page is visible or hidden.
```js
const isBrowserTabFocused = () => !document.hidden;