Feat: Implement splash screen with progress indicators during startup

This commit is contained in:
MasterAcnolo
2026-04-11 22:36:42 +02:00
parent ca8b107f61
commit 8be47b9821
4 changed files with 144 additions and 0 deletions

37
app/splashManager.js Normal file
View File

@@ -0,0 +1,37 @@
const { BrowserWindow } = require("electron");
const path = require("path");
let splashWindow = null;
function createSplashWindow() {
splashWindow = new BrowserWindow({
width: 400,
height: 300,
frame: false,
transparent: true,
alwaysOnTop: true,
resizable: false,
skipTaskbar: true,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
},
});
splashWindow.loadFile(path.join(__dirname, "../public/splash.html"));
}
function closeSplashWindow() {
if (splashWindow) {
splashWindow.close();
splashWindow = null;
}
}
function setSplashProgress(step) {
if (splashWindow) {
splashWindow.webContents.executeJavaScript(`window.setProgress(${step})`);
}
}
module.exports = { createSplashWindow, closeSplashWindow, setSplashProgress };