1window.addEventListener('online', function(e) {
2 // add your logic to update the UI when online
3 console.log("You are online");
4 document.body.style.filter = 'grayscale(0)';
5}, false);
6
7window.addEventListener('offline', function(e) {
8 // add your logic to update the UI when offline
9 console.log("You are offline");
10 document.body.style.filter = 'grayscale(1)';
11}, false);
12