Open kevinabouhanna opened 2 years ago
check about using this event listener document.addEventListener('visibilitychange',function(){} );
An example of how I have implemented this feature can be found here https://github.com/gk-git/gabykaram/blob/main/src/components/Global/CurrentlyPlaying/CurrentlyPlaying.tsx.
But I took a simple decision to not run the API call when the tab isn't active
https://usefulangle.com/post/280/settimeout-setinterval-on-inactive-tab https://www.w3.org/TR/page-visibility/
Thank you for the feedback @hassan-jammal