MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / createLoadingWindow

Function createLoadingWindow

electron/main.mjs:343–383  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

341}
342
343function 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
385function createMainWindow() {
386 mainWin = new BrowserWindow({

Callers 2

failStartupFunction · 0.85
main.mjsFile · 0.85

Calls 1

sendMethod · 0.80

Tested by

no test coverage detected