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';
|
|
|
|
|
2022-03-21 20:02:37 +01:00
|
|
|
type textType = 'wxml' | 'mm';
|
2022-03-08 18:30:34 +01:00
|
|
|
|
|
|
|
export default class TextImporterFactory {
|
2022-03-21 20:02:37 +01:00
|
|
|
static create(type: textType, 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}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|