mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-28 00:55:16 -07:00
feat(config): add configuration window (#70)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user