blob: aeea35a1863160a6c2c0247c5e73752f6375dd8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
const ipcRenderer = require("electron").ipcRenderer;
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) => {
return await ipcRenderer.invoke("request", ...args);
}
request.delete_cache = () => {
ipcRenderer.send("delete-request-cache");
}
module.exports = request;
|