Files
OmniRoute/electron/lib/windowClosePolicy.js
backryun 8122f6b71c perf(electron): optionally unload renderer on close (4/8) (#10328)
Merged — locally validated (73/73 focused electron tests, typecheck:core clean, gates green) after resolving base-drift against #10327 (both landed today, real interleaved logic in createWindow/showMainWindow/window-all-closed — combined so the hidden-start lazy-open path from #10327 and the unload-on-close path from this PR both stay intact; verified by the existing test 'keeps the non-macOS app alive when unloading its last renderer'). Nice pair of electron perf PRs, thanks!
2026-08-20 11:33:45 -03:00

27 lines
639 B
JavaScript

"use strict";
const CLOSE_BEHAVIOR_KEEP_LOADED = "keep-loaded";
const CLOSE_BEHAVIOR_UNLOAD = "unload";
function normalizeCloseBehavior(value) {
if (value === CLOSE_BEHAVIOR_KEEP_LOADED || value === CLOSE_BEHAVIOR_UNLOAD) return value;
return null;
}
function resolveRendererUrl(currentUrl, serverUrl) {
try {
const current = new URL(currentUrl);
const server = new URL(serverUrl);
return current.origin === server.origin ? current.href : server.href;
} catch {
return serverUrl;
}
}
module.exports = {
CLOSE_BEHAVIOR_KEEP_LOADED,
CLOSE_BEHAVIOR_UNLOAD,
normalizeCloseBehavior,
resolveRendererUrl,
};