mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
feat(core): add module scaffolding and provider registries
This commit is contained in:
45
src/core/app-context.ts
Normal file
45
src/core/app-context.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import {
|
||||
AnkiConnectConfig,
|
||||
JimakuApiResponse,
|
||||
JimakuDownloadQuery,
|
||||
JimakuDownloadResult,
|
||||
JimakuEntry,
|
||||
JimakuFileEntry,
|
||||
JimakuFilesQuery,
|
||||
JimakuMediaInfo,
|
||||
JimakuSearchQuery,
|
||||
RuntimeOptionState,
|
||||
SubsyncManualRunRequest,
|
||||
SubsyncMode,
|
||||
SubsyncResult,
|
||||
} from "../types";
|
||||
|
||||
export interface RuntimeOptionsModuleContext {
|
||||
getAnkiConfig: () => AnkiConnectConfig;
|
||||
applyAnkiPatch: (patch: Partial<AnkiConnectConfig>) => void;
|
||||
onOptionsChanged: (options: RuntimeOptionState[]) => void;
|
||||
}
|
||||
|
||||
export interface AppContext {
|
||||
runtimeOptions?: RuntimeOptionsModuleContext;
|
||||
jimaku?: {
|
||||
getMediaInfo: () => JimakuMediaInfo;
|
||||
searchEntries: (
|
||||
query: JimakuSearchQuery,
|
||||
) => Promise<JimakuApiResponse<JimakuEntry[]>>;
|
||||
listFiles: (
|
||||
query: JimakuFilesQuery,
|
||||
) => Promise<JimakuApiResponse<JimakuFileEntry[]>>;
|
||||
downloadFile: (
|
||||
query: JimakuDownloadQuery,
|
||||
) => Promise<JimakuDownloadResult>;
|
||||
};
|
||||
subsync?: {
|
||||
getDefaultMode: () => SubsyncMode;
|
||||
openManualPicker: () => Promise<void>;
|
||||
runAuto: () => Promise<SubsyncResult>;
|
||||
runManual: (request: SubsyncManualRunRequest) => Promise<SubsyncResult>;
|
||||
showOsd: (message: string) => void;
|
||||
runWithSpinner: <T>(task: () => Promise<T>, label?: string) => Promise<T>;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user