Mercurial > hg > ugly-duckling
comparison src/app/feature-extraction-menu/feature-extraction-menu.component.ts @ 426:8fee76ab8e90
Take a callback as a prop for performing an action when requesting an output
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Tue, 06 Jun 2017 22:11:59 +0100 |
parents | 4387175f594b |
children | 686cf74aa0a2 |
comparison
equal
deleted
inserted
replaced
425:78c32c94d201 | 426:8fee76ab8e90 |
---|---|
38 } | 38 } |
39 | 39 |
40 get disabled() { | 40 get disabled() { |
41 return this.isDisabled; | 41 return this.isDisabled; |
42 } | 42 } |
43 @Input() onRequestOutput: () => void; | |
43 | 44 |
44 @Output() requestOutput: EventEmitter<ExtractorOutputInfo>; | 45 @Output() requestOutput: EventEmitter<ExtractorOutputInfo>; |
45 | 46 |
46 private isDisabled: boolean; | 47 private isDisabled: boolean; |
47 private populateExtractors: (available: ListResponse) => void; | 48 private populateExtractors: (available: ListResponse) => void; |
84 this.piperService.librariesUpdated$.subscribe(this.populateExtractors); | 85 this.piperService.librariesUpdated$.subscribe(this.populateExtractors); |
85 this.piperService.list().then(this.populateExtractors); | 86 this.piperService.list().then(this.populateExtractors); |
86 } | 87 } |
87 | 88 |
88 extract(info: ExtractorOutputInfo): void { | 89 extract(info: ExtractorOutputInfo): void { |
89 console.warn('extract?', info); | 90 if (this.onRequestOutput) { |
91 this.onRequestOutput(); | |
92 } | |
90 if (info) { | 93 if (info) { |
91 console.warn('emit'); | |
92 this.requestOutput.emit(info); | 94 this.requestOutput.emit(info); |
93 } | 95 } |
94 } | 96 } |
95 | 97 |
96 load(): void { | 98 load(): void { |