Click to start using setTimeout with a callback to make a simple HTTP request every 2000ms.
setTimeout
Click to start making requests (as above) but using the Visibility API and AbortController to workaround the issue.
AbortController