This post describes how we detect and communicate network status as part of making Superhuman the fastest and most reliable email experience in the world. Our previous post described an offline…
— Read on blog.superhuman.com/building-reliable-apps-on-unreliable-networks-3f75743fc457

Summary
In this case, they detect online/offline state in a web browser mostly for the purpose of communicating that state to the user so they can tell what is going on.
The web app keeps track of network state. If a network request times out, the state is set to offline. Then it polls every 10 seconds to see when the network comes back online.
This approach seems alright for a webapp, but in a mobile app I think we’d avoid polio every 10 seconds to see if the app is online. Perhaps poll on the next natural network request instead, or trigger on events such as view-will-appear or return-to-foreground.