blob: cc73f1b4e4525456b38df274ca96af87f714c623 (
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;
let update_status = () => {
// show a toast message if no Internet connection has been detected.
if (! navigator.onLine) {
ipcRenderer.send("no-internet");
}
}
window.addEventListener("online", update_status);
window.addEventListener("offline", update_status);
update_status();
// 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;
|