Network connection JavaScript module with online/offline events
state:
To test the offline event, unplug or disable your internet connection. To test the online event, do the opposite.
Open the console to play with cxn in the browser.
cxn