mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-01 18:22:41 -08:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
73
src/main/runtime/mining-actions.ts
Normal file
73
src/main/runtime/mining-actions.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
export function createHandleMultiCopyDigitHandler<TSubtitleTimingTracker>(deps: {
|
||||
getSubtitleTimingTracker: () => TSubtitleTimingTracker;
|
||||
writeClipboardText: (text: string) => void;
|
||||
showMpvOsd: (text: string) => void;
|
||||
handleMultiCopyDigitCore: (
|
||||
count: number,
|
||||
options: {
|
||||
subtitleTimingTracker: TSubtitleTimingTracker;
|
||||
writeClipboardText: (text: string) => void;
|
||||
showMpvOsd: (text: string) => void;
|
||||
},
|
||||
) => void;
|
||||
}) {
|
||||
return (count: number): void => {
|
||||
deps.handleMultiCopyDigitCore(count, {
|
||||
subtitleTimingTracker: deps.getSubtitleTimingTracker(),
|
||||
writeClipboardText: deps.writeClipboardText,
|
||||
showMpvOsd: deps.showMpvOsd,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function createCopyCurrentSubtitleHandler<TSubtitleTimingTracker>(deps: {
|
||||
getSubtitleTimingTracker: () => TSubtitleTimingTracker;
|
||||
writeClipboardText: (text: string) => void;
|
||||
showMpvOsd: (text: string) => void;
|
||||
copyCurrentSubtitleCore: (options: {
|
||||
subtitleTimingTracker: TSubtitleTimingTracker;
|
||||
writeClipboardText: (text: string) => void;
|
||||
showMpvOsd: (text: string) => void;
|
||||
}) => void;
|
||||
}) {
|
||||
return (): void => {
|
||||
deps.copyCurrentSubtitleCore({
|
||||
subtitleTimingTracker: deps.getSubtitleTimingTracker(),
|
||||
writeClipboardText: deps.writeClipboardText,
|
||||
showMpvOsd: deps.showMpvOsd,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function createHandleMineSentenceDigitHandler<TSubtitleTimingTracker, TAnkiIntegration>(
|
||||
deps: {
|
||||
getSubtitleTimingTracker: () => TSubtitleTimingTracker;
|
||||
getAnkiIntegration: () => TAnkiIntegration;
|
||||
getCurrentSecondarySubText: () => string | undefined;
|
||||
showMpvOsd: (text: string) => void;
|
||||
logError: (message: string, err: unknown) => void;
|
||||
onCardsMined: (count: number) => void;
|
||||
handleMineSentenceDigitCore: (
|
||||
count: number,
|
||||
options: {
|
||||
subtitleTimingTracker: TSubtitleTimingTracker;
|
||||
ankiIntegration: TAnkiIntegration;
|
||||
getCurrentSecondarySubText: () => string | undefined;
|
||||
showMpvOsd: (text: string) => void;
|
||||
logError: (message: string, err: unknown) => void;
|
||||
onCardsMined: (count: number) => void;
|
||||
},
|
||||
) => void;
|
||||
},
|
||||
) {
|
||||
return (count: number): void => {
|
||||
deps.handleMineSentenceDigitCore(count, {
|
||||
subtitleTimingTracker: deps.getSubtitleTimingTracker(),
|
||||
ankiIntegration: deps.getAnkiIntegration(),
|
||||
getCurrentSecondarySubText: deps.getCurrentSecondarySubText,
|
||||
showMpvOsd: deps.showMpvOsd,
|
||||
logError: deps.logError,
|
||||
onCardsMined: deps.onCardsMined,
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user