Mercurial > hg > ugly-duckling
comparison src/app/feature-extraction-menu/feature-extraction-menu.component.ts @ 324:e433a2da0ada
Refactor the import library logic slightly to waterfall the loading of the libraries and list requests, and send one response when all libraries have been loaded.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Tue, 16 May 2017 16:16:57 +0100 |
parents | 89208e8af8cc |
children | 4387175f594b |
comparison
equal
deleted
inserted
replaced
323:72673c954216 | 324:e433a2da0ada |
---|---|
78 } | 78 } |
79 return ''; | 79 return ''; |
80 } | 80 } |
81 | 81 |
82 ngOnInit() { | 82 ngOnInit() { |
83 this.piperService.list().then(this.populateExtractors).then(() => { | |
84 this.piperService.load('pyin'); | |
85 // this.piperService.load('nnls-chroma'); | |
86 }); | |
87 this.librariesUpdatedSubscription = | 83 this.librariesUpdatedSubscription = |
88 this.piperService.librariesUpdated$.subscribe(this.populateExtractors); | 84 this.piperService.librariesUpdated$.subscribe(this.populateExtractors); |
85 this.piperService.list().then(this.populateExtractors); | |
89 } | 86 } |
90 | 87 |
91 extract(combinedKey: string): void { | 88 extract(combinedKey: string): void { |
92 const info: ExtractorOutputInfo = | 89 const info: ExtractorOutputInfo = |
93 this.extractorsMap.get(combinedKey); | 90 this.extractorsMap.get(combinedKey); |
95 this.requestOutput.emit(info); | 92 this.requestOutput.emit(info); |
96 } | 93 } |
97 } | 94 } |
98 | 95 |
99 load(): void { | 96 load(): void { |
100 this.piperService.updateAvailableLibraries().subscribe(res => { | 97 this.piperService.updateAvailableLibraries(); |
101 Object.keys(res).forEach(key => this.piperService.load(key)); | |
102 }); | |
103 } | 98 } |
104 | 99 |
105 ngOnDestroy(): void { | 100 ngOnDestroy(): void { |
106 this.librariesUpdatedSubscription.unsubscribe(); | 101 this.librariesUpdatedSubscription.unsubscribe(); |
107 } | 102 } |