diff options
author | 0neGal <mail@0negal.com> | 2024-06-09 18:09:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-09 18:09:26 +0200 |
commit | 04b0e9fcea6c60257d7bc68994103eacb340a82b (patch) | |
tree | cd46c3c09f11f839eebb0e4dc682ca6c85689bf6 /src/modules | |
parent | 3904a4492f72ef9a9fd531c0b81f3711541c97e0 (diff) | |
parent | aa53f7a5fd5408596d6cc1ea579d68d1ae897698 (diff) | |
download | Viper-04b0e9fcea6c60257d7bc68994103eacb340a82b.tar.gz Viper-04b0e9fcea6c60257d7bc68994103eacb340a82b.zip |
Merge pull request #237 from 0neGal/modularized-frontend
chore: Modularize the frontend code
Generally this should be fine, there might still be some uncaught bugs, but it hopefully isn't anything too major.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/kill.js | 10 | ||||
-rw-r--r-- | src/modules/launch.js | 5 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/modules/kill.js b/src/modules/kill.js index 5d03218..b0c4f97 100644 --- a/src/modules/kill.js +++ b/src/modules/kill.js @@ -1,12 +1,10 @@ const exec = require("child_process").exec; const ipcMain = require("electron").ipcMain; -ipcMain.on("kill-game", () => { - kill.game(); -}) - -ipcMain.on("kill-origin", () => { - kill.origin(); +ipcMain.on("kill", (function_name) => { + if (typeof kill[function_name] == "function") { + kill[function_name](); + } }) // a simple function to kill processes with a certain name diff --git a/src/modules/launch.js b/src/modules/launch.js index 73ce408..7faf372 100644 --- a/src/modules/launch.js +++ b/src/modules/launch.js @@ -9,9 +9,8 @@ const settings = require("./settings"); console = require("./console"); -ipcMain.on("launch-ns", launch); -ipcMain.on("launch-vanilla", () => { - launch("vanilla"); +ipcMain.on("launch", (_, game_version) => { + launch(game_version) }) // launches the game |