Is there a reliable way for service workers to detect if the tab that registered it has closed? The use case I'm concerned about is trying to get the service worker to run specific code after a tab is closed?
The way I'm doing this currently is by sending healthcheck messages to the service worker, and once these messages stop, we can assume that the tab has been closed. However, this is not completely reliable because browsers throttle tabs that are not in focus, which leads to healthcheck messages being sent inconsistently.
Anyone have any other ideas?