mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-21 12:11:28 -07:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
25
src/main/runtime/mpv-osd-log-main-deps.ts
Normal file
25
src/main/runtime/mpv-osd-log-main-deps.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { createAppendToMpvLogHandler, createShowMpvOsdHandler } from './mpv-osd-log';
|
||||
|
||||
type AppendToMpvLogMainDeps = Parameters<typeof createAppendToMpvLogHandler>[0];
|
||||
type ShowMpvOsdMainDeps = Parameters<typeof createShowMpvOsdHandler>[0];
|
||||
|
||||
export function createBuildAppendToMpvLogMainDepsHandler(deps: AppendToMpvLogMainDeps) {
|
||||
return (): AppendToMpvLogMainDeps => ({
|
||||
logPath: deps.logPath,
|
||||
dirname: (targetPath: string) => deps.dirname(targetPath),
|
||||
mkdir: (targetPath: string, options: { recursive: boolean }) => deps.mkdir(targetPath, options),
|
||||
appendFile: (targetPath: string, data: string, options: { encoding: 'utf8' }) =>
|
||||
deps.appendFile(targetPath, data, options),
|
||||
now: () => deps.now(),
|
||||
});
|
||||
}
|
||||
|
||||
export function createBuildShowMpvOsdMainDepsHandler(deps: ShowMpvOsdMainDeps) {
|
||||
return (): ShowMpvOsdMainDeps => ({
|
||||
appendToMpvLog: (message: string) => deps.appendToMpvLog(message),
|
||||
showMpvOsdRuntime: (mpvClient, text, fallbackLog) =>
|
||||
deps.showMpvOsdRuntime(mpvClient, text, fallbackLog),
|
||||
getMpvClient: () => deps.getMpvClient(),
|
||||
logInfo: (line: string) => deps.logInfo(line),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user