cleaned up download progress

This commit is contained in:
Cuptain 2024-06-24 09:49:20 +10:00
parent 79d7869382
commit 144f098661

View File

@ -10,8 +10,10 @@ let greetMsgEl;
const download_progress = listen("download_progress", (progress) => {
console.log("Downloading");
//console.log("Downloaded "+progress.payload.downloaded/(1024*1024) +"MB / " + progress.payload.total/(1024*1024) + "MB");
let downProgress = (progress.payload.downloaded/(1024*1024)).toFixed(2);
let downTotal = (progress.payload.total/(1024*1024)).toFixed(2);
document.getElementById("download_name").textContent = "Downloading "+progress.payload.download_name;
document.getElementById("download_progress").textContent = progress.payload.downloaded/(1024*1024) + "MB / "+progress.payload.total/(1024*1024)+"MB";
document.getElementById("download_progress").textContent = downProgress + "MB / "+downTotal+"MB";
document.getElementById("launchGame").disabled = true;
});
@ -19,6 +21,7 @@ const download_finished = listen("download_finished", (event) => {
document.getElementById("download_name").textContent = "";
document.getElementById("download_progress").textContent = "";
document.getElementById("launchGame").disabled = false;
document.getElementById("launchGame").textContent ="Launch Minecraft";
});
const update_dialog = listen("update_dialog", (event) => {
@ -67,6 +70,7 @@ function gameLaunch() {
var packId = document.getElementById("Modpacks");
var selectedId = packId.value;
document.getElementById("launchGame").disabled = true;
document.getElementById("launchGame").textContent ="Launching...";
//TODO Launch Game
invoke("launch_modpack", { id: selectedId}).then(window.close);