mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-21 22:52:19 +03:00
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!
27 lines
639 B
JavaScript
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,
|
|
};
|