mirror of
https://github.com/mmvanheusden/SteamDepotDownloaderGUI.git
synced 2026-02-04 05:31:19 +01:00
Outrule the possibility that the page might not be fully loaded on older machines will break stuff
This commit is contained in:
@@ -124,14 +124,18 @@ function checkSelection() {
|
||||
}
|
||||
}
|
||||
|
||||
// This changes the dropdown selection, based on the platform being used.
|
||||
ipcRenderer.on("update-value", (e, msg) => {
|
||||
|
||||
// main.js sends a ready message if the page is loaded in. This will be received here.
|
||||
// process.platform -> 'linux' -> selectedIndex = 2 (Linux)
|
||||
// process.platform -> 'win32' -> selectedIndex = 0 (Windows)
|
||||
// process.platform -> 'darwin' -> selectedIndex = 1 (macOS)
|
||||
ipcRenderer.on("ready", () => {
|
||||
const osdropdown = document.getElementById("osdropdown")
|
||||
if (msg === "linux") {
|
||||
if (process.platform.toString().includes("linux")) {
|
||||
osdropdown.selectedIndex = 2
|
||||
} else if (msg === "win") {
|
||||
} else if (process.platform.toString().includes("win")) {
|
||||
osdropdown.selectedIndex = 0
|
||||
} else if (msg === "darwin") {
|
||||
} else if (process.platform.toString().includes("darwin")) {
|
||||
osdropdown.selectedIndex = 1
|
||||
}
|
||||
checkSelection() // force check the selection so the terminal dropdown can be unhidden.
|
||||
|
||||
12
main.js
12
main.js
@@ -39,11 +39,13 @@ app.whenReady().then(() => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
||||
// Waits one second so the DOM is ready, and then sends the process platform to the downloader.
|
||||
// TODO: On slow machine this WILL cause issues. Fix required!
|
||||
setTimeout(() => {
|
||||
BrowserWindow.getFocusedWindow().webContents.postMessage("update-value", (process.platform.toString() || "win"))
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
// If the page is fully loaded in, send a sign.
|
||||
app.on("web-contents-created", (event, contents) => {
|
||||
contents.on("dom-ready", () => {
|
||||
contents.send("ready")
|
||||
})
|
||||
})
|
||||
|
||||
// Quit when all windows are closed, except on macOS. There, it's common
|
||||
|
||||
Reference in New Issue
Block a user