mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
refactor(main): extract IPC runtime deps factories
This commit is contained in:
22
src/main.ts
22
src/main.ts
@@ -1524,7 +1524,15 @@ const runtimeOptionsIpcDeps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
registerIpcHandlersService(
|
registerIpcHandlersService(
|
||||||
createIpcDepsRuntimeService({
|
createIpcDepsRuntimeService(createMainIpcRuntimeServiceDeps()),
|
||||||
|
);
|
||||||
|
|
||||||
|
registerAnkiJimakuIpcRuntimeService(
|
||||||
|
createAnkiJimakuIpcRuntimeServiceDeps(),
|
||||||
|
);
|
||||||
|
|
||||||
|
function createMainIpcRuntimeServiceDeps() {
|
||||||
|
return {
|
||||||
getInvisibleWindow: () => overlayManager.getInvisibleWindow(),
|
getInvisibleWindow: () => overlayManager.getInvisibleWindow(),
|
||||||
getMainWindow: () => overlayManager.getMainWindow(),
|
getMainWindow: () => overlayManager.getMainWindow(),
|
||||||
getVisibleOverlayVisibility: () => overlayManager.getVisibleOverlayVisible(),
|
getVisibleOverlayVisibility: () => overlayManager.getVisibleOverlayVisible(),
|
||||||
@@ -1556,11 +1564,11 @@ registerIpcHandlersService(
|
|||||||
reportOverlayContentBounds: (payload) => {
|
reportOverlayContentBounds: (payload) => {
|
||||||
overlayContentMeasurementStore.report(payload);
|
overlayContentMeasurementStore.report(payload);
|
||||||
},
|
},
|
||||||
}),
|
};
|
||||||
);
|
}
|
||||||
|
|
||||||
registerAnkiJimakuIpcRuntimeService(
|
function createAnkiJimakuIpcRuntimeServiceDeps() {
|
||||||
{
|
return {
|
||||||
patchAnkiConnectEnabled: (enabled) => {
|
patchAnkiConnectEnabled: (enabled) => {
|
||||||
configService.patchRawConfig({ ankiConnect: { enabled } });
|
configService.patchRawConfig({ ankiConnect: { enabled } });
|
||||||
},
|
},
|
||||||
@@ -1586,5 +1594,5 @@ registerAnkiJimakuIpcRuntimeService(
|
|||||||
isRemoteMediaPath: (mediaPath) => isRemoteMediaPath(mediaPath),
|
isRemoteMediaPath: (mediaPath) => isRemoteMediaPath(mediaPath),
|
||||||
downloadToFile: (url, destPath, headers) =>
|
downloadToFile: (url, destPath, headers) =>
|
||||||
downloadToFile(url, destPath, headers),
|
downloadToFile(url, destPath, headers),
|
||||||
},
|
};
|
||||||
);
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user