mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
Feat: Implement splash screen with progress indicators during startup
This commit is contained in:
37
app/splashManager.js
Normal file
37
app/splashManager.js
Normal 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 };
|
||||
Reference in New Issue
Block a user