wisemapping-frontend/packages/mindplot/src/components/import/TextImporterFactory.ts
2022-03-25 22:48:05 -03:00

20 lines
541 B
TypeScript

import WisemappingImporter from './WisemappingImporter';
import FreemindImporter from './FreemindImporter';
import Importer from './Importer';
export default class TextImporterFactory {
static create(type: string, map: string): Importer {
let result: Importer;
switch (type) {
case 'wxml':
result = new WisemappingImporter(map);
return result;
case 'mm':
result = new FreemindImporter(map);
return result;
default:
throw new Error(`Unsupported type ${type}`);
}
}
}