summaryrefslogtreecommitdiff
path: root/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/app.js')
-rw-r--r--js/app.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/js/app.js b/js/app.js
index 585726a..fcc8bfe 100644
--- a/js/app.js
+++ b/js/app.js
@@ -51,6 +51,7 @@ const App = {
}
App.initNightMode();
+ App.initOfflineEvents();
if ('serviceWorker' in navigator) {
navigator.serviceWorker
@@ -199,7 +200,19 @@ const App = {
});
}
},
+ initOfflineEvents: function() {
+ if (typeof EpubeApp != "undefined") {
+ $(window).on('online', function() {
+ EpubeApp.setOffline(false);
+ });
+
+ $(window).on('offline', function() {
+ EpubeApp.setOffline(true);
+ });
+ EpubeApp.setOffline(!navigator.onLine);
+ }
+ },
initNightMode: function() {
if (window.matchMedia) {
const mql = window.matchMedia('(prefers-color-scheme: dark)');
@@ -227,6 +240,7 @@ const App = {
}
App.initNightMode();
+ App.initOfflineEvents();
if ('serviceWorker' in navigator) {
navigator.serviceWorker