diff options
author | 0neGal <mail@0negal.com> | 2024-06-08 18:02:48 +0200 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2024-06-08 18:02:48 +0200 |
commit | dbd8c6b152acc1188d2edd288488aa2da8f6310b (patch) | |
tree | ef5a1752e845a274c889ee18207c3a25e8290b23 /src/app/js/request.js | |
parent | 3904a4492f72ef9a9fd531c0b81f3711541c97e0 (diff) | |
download | Viper-dbd8c6b152acc1188d2edd288488aa2da8f6310b.tar.gz Viper-dbd8c6b152acc1188d2edd288488aa2da8f6310b.zip |
initial commit to better modularize frontend
Far from done, but this pretty much splits everything inside
`src/app/main.js` into separate files.
Diffstat (limited to 'src/app/js/request.js')
-rw-r--r-- | src/app/js/request.js | 18 |
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; |