()
| 341 | } |
| 342 | |
| 343 | function createLoadingWindow() { |
| 344 | bootLogReady = false; |
| 345 | loadingWin = new BrowserWindow({ |
| 346 | width: LOADING_WIN_WIDTH, |
| 347 | // Tall enough to fit the streaming status line + the "first launch can |
| 348 | // take a few minutes" hint without scrollbars. |
| 349 | height: LOADING_WIN_HEIGHT, |
| 350 | resizable: false, |
| 351 | frame: false, |
| 352 | center: true, |
| 353 | show: false, |
| 354 | // Pre-paint window color; must match --oh-background in loading.html. |
| 355 | backgroundColor: "#0b0e14", |
| 356 | icon: appIconPath, |
| 357 | webPreferences: { |
| 358 | nodeIntegration: false, |
| 359 | contextIsolation: true, |
| 360 | // Bridges the startup-log console over IPC (see preload.cjs). |
| 361 | preload: join(__dirname, "preload.cjs"), |
| 362 | }, |
| 363 | }); |
| 364 | |
| 365 | // The renderer can only receive IPC once the page has loaded — replay the |
| 366 | // lines buffered until now, then stream live batches (see appendBootLog). |
| 367 | loadingWin.webContents.on("did-finish-load", () => { |
| 368 | if (!loadingWin || loadingWin.isDestroyed()) return; |
| 369 | clearTimeout(bootLogFlushTimer); |
| 370 | bootLogFlushTimer = null; |
| 371 | bootLogPending = []; |
| 372 | if (bootLog.length) { |
| 373 | loadingWin.webContents.send("boot-log:batch", bootLog.slice()); |
| 374 | } |
| 375 | bootLogReady = true; |
| 376 | if (fatalSummary) { |
| 377 | loadingWin.webContents.send("boot-log:fatal", fatalSummary); |
| 378 | } |
| 379 | }); |
| 380 | |
| 381 | loadingWin.loadFile(join(__dirname, "loading.html")); |
| 382 | loadingWin.once("ready-to-show", () => loadingWin?.show()); |
| 383 | } |
| 384 | |
| 385 | function createMainWindow() { |
| 386 | mainWin = new BrowserWindow({ |
no test coverage detected