INNER CODE UNIT · TypeScript
openAppWindow
elie222/inbox-zero · apps/desktop/src/main.ts:638
function openAppWindow(url: string, options?: { navigate?: boolean }) {
const accountId = getDesktopMailAccountId(url, appOrigin);
const existing = accountId
? windows.find((window) => windowAccountId(window) === accountId)
: undefined;
if (existing) {
if (options?.navigate) {
const current =
lastUrlByWindow.get(existing) ?? existing.webContents.getURL();
if (current !== url) existing.loadURL(url).catch(() => {});
}
showWindow(existing);
return existing;
}
return createAppWindow({ url });
}
function windowAccountId(window: BrowserWindow) {