aboutsummaryrefslogtreecommitdiff
path: root/src/app/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/js')
-rw-r--r--src/app/js/browser.js1
-rw-r--r--src/app/js/request.js12
2 files changed, 9 insertions, 4 deletions
diff --git a/src/app/js/browser.js b/src/app/js/browser.js
index 88e8017..d30ad9f 100644
--- a/src/app/js/browser.js
+++ b/src/app/js/browser.js
@@ -563,7 +563,6 @@ ipcRenderer.on("legacy-duped-mod", (_, modname) => {
})
ipcRenderer.on("no-internet", () => {
- set_buttons(true);
toasts.show({
timeout: 10000,
scheme: "error",
diff --git a/src/app/js/request.js b/src/app/js/request.js
index 29b8883..aeea35a 100644
--- a/src/app/js/request.js
+++ b/src/app/js/request.js
@@ -1,10 +1,16 @@
const ipcRenderer = require("electron").ipcRenderer;
-// show a toast message if no Internet connection has been detected.
-if (! navigator.onLine) {
- ipcRenderer.send("no-internet");
+const updateOnlineStatus = () => {
+ // show a toast message if no Internet connection has been detected.
+ if (!navigator.onLine) {
+ ipcRenderer.send("no-internet");
+ }
}
+window.addEventListener('online', updateOnlineStatus);
+window.addEventListener('offline', updateOnlineStatus);
+updateOnlineStatus();
+
// invokes `requests.get()` from `src/modules/requests.js` through the
// main process, and returns the output
let request = async (...args) => {