12aa6d7343
* rework online detection doc and fiddle * add footnote * Update docs/tutorial/online-offline-events.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * Update docs/tutorial/online-offline-events.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * Update docs/tutorial/online-offline-events.md * Update docs/tutorial/online-offline-events.md * Update docs/tutorial/online-offline-events.md * chore: fix lint error Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Cheng Zhao <github@zcbenz.com>
8 lines
267 B
JavaScript
8 lines
267 B
JavaScript
function onlineStatusIndicator () {
|
|
document.getElementById('status').innerHTML = navigator.onLine ? 'online' : 'offline'
|
|
}
|
|
|
|
window.addEventListener('online', onlineStatusIndicator)
|
|
window.addEventListener('offline', onlineStatusIndicator)
|
|
|
|
onlineStatusIndicator()
|