refactor: inline subtitle-prefetch-runtime-composer

The composer was a pure pass-through that destructured an object and
reassembled it with the same fields. Inlined at the call site.
This commit is contained in:
2026-03-28 11:11:49 -07:00
parent 1a448cf7d9
commit 916dd5d37d
4 changed files with 6 additions and 62 deletions

View File

@@ -10,5 +10,4 @@ export * from './jellyfin-runtime-composer';
export * from './mpv-runtime-composer';
export * from './overlay-visibility-runtime-composer';
export * from './shortcuts-runtime-composer';
export * from './subtitle-prefetch-runtime-composer';
export * from './startup-lifecycle-composer';

View File

@@ -1,23 +0,0 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { composeSubtitlePrefetchRuntime } from './subtitle-prefetch-runtime-composer';
test('composeSubtitlePrefetchRuntime returns subtitle prefetch runtime helpers', () => {
const composed = composeSubtitlePrefetchRuntime({
subtitlePrefetchInitController: {
cancelPendingInit: () => {},
initSubtitlePrefetch: async () => {},
},
refreshSubtitleSidebarFromSource: async () => {},
refreshSubtitlePrefetchFromActiveTrack: async () => {},
scheduleSubtitlePrefetchRefresh: () => {},
clearScheduledSubtitlePrefetchRefresh: () => {},
});
assert.equal(typeof composed.cancelPendingInit, 'function');
assert.equal(typeof composed.initSubtitlePrefetch, 'function');
assert.equal(typeof composed.refreshSubtitleSidebarFromSource, 'function');
assert.equal(typeof composed.refreshSubtitlePrefetchFromActiveTrack, 'function');
assert.equal(typeof composed.scheduleSubtitlePrefetchRefresh, 'function');
assert.equal(typeof composed.clearScheduledSubtitlePrefetchRefresh, 'function');
});

View File

@@ -1,32 +0,0 @@
import type { SubtitlePrefetchInitController } from '../subtitle-prefetch-init';
import type { ComposerInputs, ComposerOutputs } from './contracts';
export type SubtitlePrefetchRuntimeComposerOptions = ComposerInputs<{
subtitlePrefetchInitController: SubtitlePrefetchInitController;
refreshSubtitleSidebarFromSource: (sourcePath: string) => Promise<void>;
refreshSubtitlePrefetchFromActiveTrack: () => Promise<void>;
scheduleSubtitlePrefetchRefresh: (delayMs?: number) => void;
clearScheduledSubtitlePrefetchRefresh: () => void;
}>;
export type SubtitlePrefetchRuntimeComposerResult = ComposerOutputs<{
cancelPendingInit: () => void;
initSubtitlePrefetch: SubtitlePrefetchInitController['initSubtitlePrefetch'];
refreshSubtitleSidebarFromSource: (sourcePath: string) => Promise<void>;
refreshSubtitlePrefetchFromActiveTrack: () => Promise<void>;
scheduleSubtitlePrefetchRefresh: (delayMs?: number) => void;
clearScheduledSubtitlePrefetchRefresh: () => void;
}>;
export function composeSubtitlePrefetchRuntime(
options: SubtitlePrefetchRuntimeComposerOptions,
): SubtitlePrefetchRuntimeComposerResult {
return {
cancelPendingInit: () => options.subtitlePrefetchInitController.cancelPendingInit(),
initSubtitlePrefetch: options.subtitlePrefetchInitController.initSubtitlePrefetch,
refreshSubtitleSidebarFromSource: options.refreshSubtitleSidebarFromSource,
refreshSubtitlePrefetchFromActiveTrack: options.refreshSubtitlePrefetchFromActiveTrack,
scheduleSubtitlePrefetchRefresh: options.scheduleSubtitlePrefetchRefresh,
clearScheduledSubtitlePrefetchRefresh: options.clearScheduledSubtitlePrefetchRefresh,
};
}