refactor: extract anki jimaku ipc deps runtime service

This commit is contained in:
2026-02-10 01:05:05 -08:00
parent e95728b4d1
commit adcae2ee01
5 changed files with 119 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ interface SubtitleTimingTrackerLike {
cleanup: () => void;
}
export function registerAnkiJimakuIpcRuntimeService(options: {
export interface AnkiJimakuIpcRuntimeOptions {
patchAnkiConnectEnabled: (enabled: boolean) => void;
getResolvedConfig: () => { ankiConnect?: AnkiConnectConfig };
getRuntimeOptionsManager: () => RuntimeOptionsManagerLike | null;
@@ -55,7 +55,11 @@ export function registerAnkiJimakuIpcRuntimeService(options: {
destPath: string,
headers: Record<string, string>,
) => Promise<{ ok: true; path: string } | { ok: false; error: { error: string; code?: number; retryAfter?: number } }>;
}): void {
}
export function registerAnkiJimakuIpcRuntimeService(
options: AnkiJimakuIpcRuntimeOptions,
): void {
registerAnkiJimakuIpcHandlers({
setAnkiConnectEnabled: (enabled) => {
options.patchAnkiConnectEnabled(enabled);