https://github.com/bogeyman76/documentvisible
A React hook to monitor if the current browser tab is visible or not.
https://github.com/bogeyman76/documentvisible
javascript jsx react react-hook typescript-react
Last synced: 2 months ago
JSON representation
A React hook to monitor if the current browser tab is visible or not.
- Host: GitHub
- URL: https://github.com/bogeyman76/documentvisible
- Owner: bogeyman76
- License: gpl-3.0
- Created: 2024-10-21T17:20:28.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-21T17:41:58.000Z (8 months ago)
- Last Synced: 2025-02-13T00:28:52.886Z (4 months ago)
- Topics: javascript, jsx, react, react-hook, typescript-react
- Language: TypeScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DocumentVisible React Hook
This is a simple react hook to determine if the current browser tab is visible. The hook uses uses Reacts useSyncExternalStore:
https://react.dev/reference/react/useSyncExternalStore
Implentation:
const isVisible = DocumentVisible(); // true or false