wisemapping-frontend/packages/mindplot/src/components/import/TextImporterFactory.ts

20 lines
541 B
TypeScript
Raw Normal View History

2022-03-21 20:02:37 +01:00
import WisemappingImporter from './WisemappingImporter';
2022-03-08 18:30:34 +01:00
import FreemindImporter from './FreemindImporter';
import Importer from './Importer';
export default class TextImporterFactory {
2022-03-26 02:48:05 +01:00
static create(type: string, map: string): Importer {
2022-03-08 18:30:34 +01:00
let result: Importer;
switch (type) {
2022-03-21 20:02:37 +01:00
case 'wxml':
result = new WisemappingImporter(map);
return result;
2022-03-08 18:30:34 +01:00
case 'mm':
result = new FreemindImporter(map);
return result;
default:
throw new Error(`Unsupported type ${type}`);
}
}
}