1 | import Configuration from '../configuration';
|
2 |
|
3 | import ExportJsonEngine from './export-json.engine';
|
4 | import ExportPdfEngine from './pdf-engine/export-pdf.engine';
|
5 |
|
6 | export class ExportEngine {
|
7 | private static instance: ExportEngine;
|
8 | private constructor() {}
|
9 | public static getInstance() {
|
10 | if (!ExportEngine.instance) {
|
11 | ExportEngine.instance = new ExportEngine();
|
12 | }
|
13 | return ExportEngine.instance;
|
14 | }
|
15 |
|
16 | public export(outputFolder, data) {
|
17 | switch (Configuration.mainData.exportFormat) {
|
18 | case 'json':
|
19 | return ExportJsonEngine.export(outputFolder, data);
|
20 | case 'pdf':
|
21 | return ExportPdfEngine.export(outputFolder);
|
22 | }
|
23 | }
|
24 | }
|
25 |
|
26 | export default ExportEngine.getInstance();
|