/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/desktop/src/main/window-state.ts
29 строк
651 B
Luke Parker
fix(desktop): guard destroyed recovery windows (#37406)
17 июл 2026, 04:22
Не верифицирован
17 июл 2026, 04:22
4436678
Код
Авторство
О чём код?
export const destroyedWindowURL = "<destroyed>" type WebContentsURLState = { isDestroyed(): boolean getURL(): string } type WindowURLState = { isDestroyed(): boolean readonly webContents: WebContentsURLState } export function safeWebContentsURL(webContents: WebContentsURLState) { try { if (webContents.isDestroyed()) return destroyedWindowURL return webContents.getURL() } catch { return destroyedWindowURL } } export function safeWindowURL(win: WindowURLState) { try { if (win.isDestroyed()) return destroyedWindowURL return safeWebContentsURL(win.webContents) } catch { return destroyedWindowURL } }