usehooks
usehooks copied to clipboard
Added a hook for usePageVisibility
Added a hook for usePageVisibility
This hook can be used to stop visual computation such as pausing a video or carousel when user is no more active on your react app. and again resuming the video or carousel when user focuses back on your app.
It uses Page Visibility API which works in tab switching in same browser and also uses window.onblur/window.onfocus events when user switches away from browser window.