mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-01 18:22:41 -08:00
refactor: extract ipc mpv and tokenizer runtime deps
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import {
|
||||
RuntimeOptionId,
|
||||
RuntimeOptionValue,
|
||||
} from "../../types";
|
||||
import {
|
||||
cycleRuntimeOptionFromIpcRuntimeService,
|
||||
RuntimeOptionsManagerLike,
|
||||
setRuntimeOptionFromIpcRuntimeService,
|
||||
} from "./runtime-options-runtime-service";
|
||||
|
||||
export interface RuntimeOptionsIpcDepsRuntimeOptions {
|
||||
getRuntimeOptionsManager: () => RuntimeOptionsManagerLike | null;
|
||||
showMpvOsd: (text: string) => void;
|
||||
}
|
||||
|
||||
export function createRuntimeOptionsIpcDepsRuntimeService(
|
||||
options: RuntimeOptionsIpcDepsRuntimeOptions,
|
||||
): {
|
||||
setRuntimeOption: (id: string, value: unknown) => unknown;
|
||||
cycleRuntimeOption: (id: string, direction: 1 | -1) => unknown;
|
||||
} {
|
||||
return {
|
||||
setRuntimeOption: (id, value) =>
|
||||
setRuntimeOptionFromIpcRuntimeService(
|
||||
options.getRuntimeOptionsManager(),
|
||||
id as RuntimeOptionId,
|
||||
value as RuntimeOptionValue,
|
||||
options.showMpvOsd,
|
||||
),
|
||||
cycleRuntimeOption: (id, direction) =>
|
||||
cycleRuntimeOptionFromIpcRuntimeService(
|
||||
options.getRuntimeOptionsManager(),
|
||||
id as RuntimeOptionId,
|
||||
direction,
|
||||
options.showMpvOsd,
|
||||
),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user