mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-25 00:11:26 -07:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
47
src/main/runtime/overlay-main-actions.ts
Normal file
47
src/main/runtime/overlay-main-actions.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import type { OverlayHostedModal } from '../overlay-runtime';
|
||||
import type { AppendClipboardVideoToQueueRuntimeDeps } from './clipboard-queue';
|
||||
|
||||
export function createSetOverlayVisibleHandler(deps: {
|
||||
setVisibleOverlayVisible: (visible: boolean) => void;
|
||||
}) {
|
||||
return (visible: boolean): void => {
|
||||
deps.setVisibleOverlayVisible(visible);
|
||||
};
|
||||
}
|
||||
|
||||
export function createToggleOverlayHandler(deps: {
|
||||
toggleVisibleOverlay: () => void;
|
||||
}) {
|
||||
return (): void => {
|
||||
deps.toggleVisibleOverlay();
|
||||
};
|
||||
}
|
||||
|
||||
export function createHandleOverlayModalClosedHandler(deps: {
|
||||
handleOverlayModalClosedRuntime: (modal: OverlayHostedModal) => void;
|
||||
}) {
|
||||
return (modal: OverlayHostedModal): void => {
|
||||
deps.handleOverlayModalClosedRuntime(modal);
|
||||
};
|
||||
}
|
||||
|
||||
export function createAppendClipboardVideoToQueueHandler(deps: {
|
||||
appendClipboardVideoToQueueRuntime: (
|
||||
options: AppendClipboardVideoToQueueRuntimeDeps,
|
||||
) => { ok: boolean; message: string };
|
||||
getMpvClient: () => AppendClipboardVideoToQueueRuntimeDeps['getMpvClient'] extends () => infer T
|
||||
? T
|
||||
: never;
|
||||
readClipboardText: () => string;
|
||||
showMpvOsd: (text: string) => void;
|
||||
sendMpvCommand: (command: (string | number)[]) => void;
|
||||
}) {
|
||||
return (): { ok: boolean; message: string } => {
|
||||
return deps.appendClipboardVideoToQueueRuntime({
|
||||
getMpvClient: () => deps.getMpvClient(),
|
||||
readClipboardText: deps.readClipboardText,
|
||||
showMpvOsd: deps.showMpvOsd,
|
||||
sendMpvCommand: deps.sendMpvCommand,
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user