Files
OmniRoute/electron/lib/windowLifecycle.js
backryun 5e508147c4 perf(electron): defer hidden-start renderer creation (#10327)
Merged — locally validated (6/6 focused lazy-window tests, plus the wider electron suite, typecheck:core clean, gates green). Thanks!
2026-08-20 11:32:08 -03:00

29 lines
722 B
JavaScript

/** Pure helpers for deciding and driving the Electron dashboard window lifecycle. */
function shouldStartHidden({ argv = [], loginItemSettings = {} } = {}) {
return (
argv.includes("--hidden") ||
argv.includes("--minimized") ||
loginItemSettings.wasOpenedAsHidden === true
);
}
function showOrCreateWindow({ appReady, getWindow, createWindow }) {
if (!appReady) return null;
const currentWindow = getWindow();
if (!currentWindow || currentWindow.isDestroyed()) {
return createWindow();
}
if (currentWindow.isMinimized()) currentWindow.restore();
currentWindow.show();
currentWindow.focus();
return currentWindow;
}
module.exports = {
shouldStartHidden,
showOrCreateWindow,
};