-
-
Save Noitidart/c028560a3386ed0759c2f4b7ed4cbb52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof unreg !== 'undefined') unreg(); | |
function logOnline() { | |
console.log('ONLINE', new Date().toLocaleTimeString()) | |
} | |
function logOffline() { | |
console.log('offline', new Date().toLocaleTimeString()) | |
} | |
function reg() { | |
window.addEventListener('online', logOnline); | |
window.addEventListener('offline', logOffline); | |
} | |
function unreg() { | |
window.removeEventListener('online', logOnline); | |
window.removeEventListener('offline', logOffline); | |
} | |
reg(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment