electron/docs/fiddles/features/online-detection/renderer.js
Ethan Arrowood 12aa6d7343
docs: Update online detection doc and fiddle (#29212)
* 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>
2021-05-24 16:34:00 +09:00

8 lines
267 B
JavaScript

function onlineStatusIndicator () {
document.getElementById('status').innerHTML = navigator.onLine ? 'online' : 'offline'
}
window.addEventListener('online', onlineStatusIndicator)
window.addEventListener('offline', onlineStatusIndicator)
onlineStatusIndicator()