1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Chore: Refactor InteropService to not use dynamic imports (#8454)

This commit is contained in:
Henry Heino
2023-07-12 02:30:38 -07:00
committed by GitHub
parent 93e4004033
commit d95d6733a1
12 changed files with 341 additions and 244 deletions

View File

@ -1,7 +1,10 @@
/* eslint-disable multiline-comment-style */
import InteropService from '../../interop/InteropService';
import { Module, ModuleType } from '../../interop/types';
import InteropService_Exporter_Custom from '../../interop/InteropService_Exporter_Custom';
import InteropService_Importer_Custom from '../../interop/InteropService_Importer_Custom';
import { makeExportModule, makeImportModule } from '../../interop/Module';
import { ModuleType } from '../../interop/types';
import { ExportModule, ImportModule } from './types';
/**
@ -19,23 +22,23 @@ import { ExportModule, ImportModule } from './types';
export default class JoplinInterop {
public async registerExportModule(module: ExportModule) {
const internalModule: Module = {
const internalModule = makeExportModule({
...module,
type: ModuleType.Exporter,
isCustom: true,
fileExtensions: module.fileExtensions ? module.fileExtensions : [],
};
}, () => new InteropService_Exporter_Custom(module));
return InteropService.instance().registerModule(internalModule);
}
public async registerImportModule(module: ImportModule) {
const internalModule: Module = {
const internalModule = makeImportModule({
...module,
type: ModuleType.Importer,
isCustom: true,
fileExtensions: module.fileExtensions ? module.fileExtensions : [],
};
}, () => {
return new InteropService_Importer_Custom(module);
});
return InteropService.instance().registerModule(internalModule);
}