From a8e0f5f0435ed6cedb4ff389ee31c210dab26100 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sat, 8 Jun 2024 18:12:13 +0200 Subject: convert js/mods.js to a CommonJS module --- src/app/index.html | 1 - src/app/js/mods.js | 13 +++++++++++-- src/app/main.js | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/app/index.html b/src/app/index.html index 1297d0a..4b89999 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -333,7 +333,6 @@ - diff --git a/src/app/js/mods.js b/src/app/js/mods.js index e105c7c..caa66a7 100644 --- a/src/app/js/mods.js +++ b/src/app/js/mods.js @@ -1,3 +1,10 @@ +const ipcRenderer = require("electron").ipcRenderer; + +const lang = require("../../lang"); + +const version = require("./version"); +const set_buttons = require("./set_buttons"); + let mods = {}; let mods_list = { @@ -15,7 +22,7 @@ mods.load = (mods_obj) => { modcount.innerHTML = `${lang("gui.mods.count")} ${mods_obj.all.length}`; let normalized_names = []; - + let set_mod = (mod) => { let name = mod.name; if (mod.package) { @@ -185,7 +192,7 @@ mods.load = (mods_obj) => { mods.toggle(mod_versions[mod].local_name); } }) - + mod_els[i].remove(); modsdiv.querySelector(".line").after(mod_el); } else { @@ -303,3 +310,5 @@ ipcRenderer.on("mods", (event, mods_obj) => { mods.load(mods_obj); }) + +module.exports = mods; diff --git a/src/app/main.js b/src/app/main.js index 11f5853..fa4ec86 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -27,6 +27,7 @@ ipcRenderer.on("unknown-error", (event, err) => { const json = require("../modules/json"); const kill = require("./js/kill"); +const mods = require("./js/mods"); const update = require("./js/update"); const events = require("./js/events"); const launch = require("./js/launch"); -- cgit v1.2.3