From 94e0592f456880e72a8d8114db80e2288958c638 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 19 Nov 2020 07:59:26 +0300 Subject: WIP: check online status via app if possible --- js/app.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'js/app.js') diff --git a/js/app.js b/js/app.js index b12ce03..d886eb5 100644 --- a/js/app.js +++ b/js/app.js @@ -199,8 +199,14 @@ const App = { .html("Could not communicate with service worker. Try reloading the page."); } }, + onLine: function() { + if (typeof EpubeApp != "undefined" && typeof EpubeApp.isOnline != "undefined") + return EpubeApp.isOnline; + else + return navigator.onLine; + }, appCheckOffline: function() { - EpubeApp.setOffline(!navigator.onLine); + EpubeApp.setOffline(!App.onLine); }, initOfflineEvents: function() { if (typeof EpubeApp != "undefined") { @@ -212,7 +218,7 @@ const App = { EpubeApp.setOffline(true); }); - EpubeApp.setOffline(!navigator.onLine); + EpubeApp.setOffline(!App.onLine); } }, initNightMode: function() { -- cgit v1.2.3