Commit 0ae74b77e37f6b289da8fb1ec08f579cc3cff00f
Committed by
GitHub
Merge pull request #3890 from vvlladd28/improvement/size-bundle/1
UI: Optimized load jsZip
Showing
1 changed file
with
10 additions
and
9 deletions
@@ -54,7 +54,6 @@ import { ImportEntitiesResultInfo, ImportEntityData } from '@shared/models/entit | @@ -54,7 +54,6 @@ import { ImportEntitiesResultInfo, ImportEntityData } from '@shared/models/entit | ||
54 | import { RequestConfig } from '@core/http/http-utils'; | 54 | import { RequestConfig } from '@core/http/http-utils'; |
55 | import { RuleChain, RuleChainImport, RuleChainMetaData } from '@shared/models/rule-chain.models'; | 55 | import { RuleChain, RuleChainImport, RuleChainMetaData } from '@shared/models/rule-chain.models'; |
56 | import { RuleChainService } from '@core/http/rule-chain.service'; | 56 | import { RuleChainService } from '@core/http/rule-chain.service'; |
57 | -import * as JSZip from 'jszip'; | ||
58 | import { FiltersInfo } from '@shared/models/query/query.models'; | 57 | import { FiltersInfo } from '@shared/models/query/query.models'; |
59 | 58 | ||
60 | // @dynamic | 59 | // @dynamic |
@@ -421,15 +420,17 @@ export class ImportExportService { | @@ -421,15 +420,17 @@ export class ImportExportService { | ||
421 | } | 420 | } |
422 | 421 | ||
423 | public exportJSZip(data: object, filename: string) { | 422 | public exportJSZip(data: object, filename: string) { |
424 | - const jsZip = new JSZip(); | ||
425 | - for (const keyName in data) { | ||
426 | - if (data.hasOwnProperty(keyName)) { | ||
427 | - const valueData = data[keyName]; | ||
428 | - jsZip.file(keyName, valueData); | 423 | + import('jszip').then((JSZip) => { |
424 | + const jsZip = new JSZip.default(); | ||
425 | + for (const keyName in data) { | ||
426 | + if (data.hasOwnProperty(keyName)) { | ||
427 | + const valueData = data[keyName]; | ||
428 | + jsZip.file(keyName, valueData); | ||
429 | + } | ||
429 | } | 430 | } |
430 | - } | ||
431 | - jsZip.generateAsync({type: 'blob'}).then(content => { | ||
432 | - this.downloadFile(content, filename, ZIP_TYPE); | 431 | + jsZip.generateAsync({type: 'blob'}).then(content => { |
432 | + this.downloadFile(content, filename, ZIP_TYPE); | ||
433 | + }); | ||
433 | }); | 434 | }); |
434 | } | 435 | } |
435 | 436 |