From e8e502cc574fdd6eaa54a3a25c2d975596c13026 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sun, 4 Feb 2024 15:40:23 +0100 Subject: move IPC events into their respective modules I've not been able to find anything that breaks from this, as I've gone through every IPC event that got moved, to ensure it still functions, and all the breakage I found has since been fixed. IPC events that dont fit in any particular module is also now in the new file named `src/app/modules/ipc.js` There's also another module `src/win.js`, which lets you get the `BrowserWindow` outside of `src/index.js` I also took the oppertunity to clean up some of the code when moving it around, and adding a couple comments, as some of it was quite horrid. --- src/modules/releases.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/modules/releases.js') diff --git a/src/modules/releases.js b/src/modules/releases.js index c071970..b041d38 100644 --- a/src/modules/releases.js +++ b/src/modules/releases.js @@ -1,3 +1,6 @@ +const win = require("../win"); +const ipcMain = require("electron").ipcMain; + const requests = require("./requests"); let releases = { @@ -5,6 +8,15 @@ let releases = { latest: {} } +// returns release notes to renderer +ipcMain.on("get-ns-notes", async () => { + win().send("ns-notes", await releases.notes.northstar()); +}) + +ipcMain.on("get-vp-notes", async () => { + win().send("vp-notes", await releases.notes.viper()); +}) + // gets and returns the release notes of a GitHub repo async function github_releases(repo) { let request = false; -- cgit v1.2.3