Files
SubMiner/src/main/runtime/yomitan-extension-overlay-reload.ts
T
sudacode edb1da2993 fix: curl fetch for Linux updater, overlay restart restore, Yomitan late
- Use /usr/bin/curl on Linux for update checks to avoid Electron net-service crashes
- Restore visible overlay on manual restart even when auto-start visibility is disabled
- Reload overlay windows after Yomitan extension loads to fix popup race on startup
2026-05-18 03:07:39 -07:00

37 lines
804 B
TypeScript

type ReloadableWebContents = {
isDestroyed?: () => boolean;
reload: () => void;
};
type ReloadableOverlayWindow = {
isDestroyed: () => boolean;
webContents?: ReloadableWebContents;
};
export function reloadOverlayWindowsForYomitanContentScripts(
windows: ReloadableOverlayWindow[],
logWarn?: (message: string, error: unknown) => void,
): number {
let reloadCount = 0;
for (const window of windows) {
if (window.isDestroyed()) {
continue;
}
const webContents = window.webContents;
if (!webContents || webContents.isDestroyed?.()) {
continue;
}
try {
webContents.reload();
reloadCount += 1;
} catch (error) {
logWarn?.('Failed to reload overlay window after Yomitan extension load.', error);
}
}
return reloadCount;
}