aboutsummaryrefslogtreecommitdiff
path: root/src/app/js/request.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/js/request.js')
-rw-r--r--src/app/js/request.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/app/js/request.js b/src/app/js/request.js
new file mode 100644
index 0000000..29b8883
--- /dev/null
+++ b/src/app/js/request.js
@@ -0,0 +1,18 @@
+const ipcRenderer = require("electron").ipcRenderer;
+
+// show a toast message if no Internet connection has been detected.
+if (! navigator.onLine) {
+ ipcRenderer.send("no-internet");
+}
+
+// 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;