At JS Camp this past weekend I saw Josh Beckman give a talk about the appropriate time to trigger a page refresh when the single page application has received some updates.
A key component of that is knowing whether you have an internet connection or not.
Fortunately there is a browser event,
offline, that will help you keep track of your offline status.
window.addEventListener('offline', () => console.log('is offline'))
When I turn the wifi off, then
is offline is logged to the console.
You can also take advantage of the
navigator.onLine (yes a capital
L) property to determine whether your application currently has an internet connection.