How do coroutines on JS platform behave in respect to web browser throttling? I'm thinking about stopping/restarting coroutines at page visibility events and I'm trying to find out the proper way to do it.
s
Sam
04/23/2024, 8:12 AM
By default, coroutines run on the page's main event loop, so if the browser is throttling timer wake-ups then it will also prevent coroutines from resuming 👍. If you need something with more fine-grained control, I would suggest looking at the docs & source code for Android's
repeatOnLifecycle
function. You might be able to make something similar that uses the page visibility API.