25 lines
859 B
TypeScript
25 lines
859 B
TypeScript
import { configureOptions } from "./configuration.js";
|
|||
|
|
import { plan } from "./planning.js";
|
||
|
|
import { archiveType } from "./type-archives.js";
|
||
|
|
import { openDocument, selectSettings, attachReader } from "./navigation.js";
|
||
|
|
import { createRegistry } from "./gen/qx.js";
|
||
|
|
import { QxReject } from "@quixos/camino-replica-core";
|
||
|
|
export const registry = createRegistry({
|
||
|
|
configureOptions,
|
||
|
|
archiveType,
|
||
|
|
plan,
|
||
|
|
openDocument,
|
||
|
|
selectSettings,
|
||
|
|
attachReader,
|
||
|
|
setReadingView: async ({ input, ports }) => {
|
||
|
|
if (!["pages", "scroll"].includes(input.displayMode)) throw new QxReject("INVALID_READING_VIEW");
|
||
|
|
await ports.reading.set(input);
|
||
|
|
return null;
|
||
|
|
},
|
||
|
|
setEnabled: async ({ input, ports }) => {
|
||
|
|
const data = await ports.data.get();
|
||
|
|
if (data.enabled !== input) await ports.data.set({ ...data, enabled: input });
|
||
|
|
return null;
|
||
|
|
},
|
||
|
|
});
|