mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 00:55:16 -07:00
edb1da2993
- 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
37 lines
804 B
TypeScript
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;
|
|
}
|