文件
mynode/packages/lib/services/interop/InteropService_Exporter_Custom.ts
chen 301194963b
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

44 行
1.4 KiB
TypeScript

import { ExportContext } from '../plugins/api/types';
import { BaseItemEntity, ResourceEntity } from '../database/types';
import InteropService_Exporter_Base from './InteropService_Exporter_Base';
import { ExportOptions } from './types';
interface CustomImporter {
onInit(context: ExportContext): Promise<void>;
onProcessItem(context: ExportContext, itemType: number, item: BaseItemEntity): Promise<void>;
onProcessResource(context: ExportContext, resource: ResourceEntity, filePath: string): Promise<void>;
onClose(context: ExportContext): Promise<void>;
}
export default class InteropService_Exporter_Custom extends InteropService_Exporter_Base {
private customContext_: ExportContext;
private module_: CustomImporter = null;
public constructor(module: CustomImporter) {
super();
this.module_ = module;
}
public async init(destPath: string, options: ExportOptions) {
this.customContext_ = {
destPath: destPath,
options: options,
};
return this.module_.onInit(this.customContext_);
}
public async processItem(itemType: number, item: BaseItemEntity) {
return this.module_.onProcessItem(this.customContext_, itemType, item);
}
public async processResource(resource: ResourceEntity, filePath: string) {
return this.module_.onProcessResource(this.customContext_, resource, filePath);
}
public async close() {
return this.module_.onClose(this.customContext_);
}
}