Wrapper for the Page Visibility API.
The scaffolding for this project is from pkg
🏠 Homepage
WIP
# Make sure you have yarn installed on your machine.
yarn add @ifake/page-visibility
# or
npm install @ifake/page-visibility- Browser
// We expose a global variable that can be used directly in the browser.constIFPageVisible=window.IFPageVisible- ES6 Module
import{pageVisibility}from'@ifake/page-visibility'pageVisibility.observe(isVisible=>{if(isVisible){// Page show do somethingconsole.log("Page show")}else{// Page hide do somethingconsole.log("Page show")}})// cancel listenpageVisibility.unobserve()WIP
- Add
blur&focusevents for browsers that don't support the API or for users who have special needs
👤 ifake
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator