| 
									
										
										
										
											2021-01-04 04:06:21 +01:00
										 |  |  | import {UIElement} from "../UIElement"; | 
					
						
							|  |  |  | import {UIEventSource} from "../../Logic/UIEventSource"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default class FeatureSwitched extends UIElement{ | 
					
						
							|  |  |  |     private readonly _upstream: UIElement; | 
					
						
							|  |  |  |     private readonly _swtch: UIEventSource<boolean>; | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     constructor(upstream :UIElement, | 
					
						
							|  |  |  |                 swtch: UIEventSource<boolean>) { | 
					
						
							|  |  |  |         super(swtch); | 
					
						
							|  |  |  |         this._upstream = upstream; | 
					
						
							|  |  |  |         this._swtch = swtch; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							| 
									
										
										
										
											2021-06-10 01:36:20 +02:00
										 |  |  |     InnerRender(): UIElement | string { | 
					
						
							| 
									
										
										
										
											2021-01-04 04:06:21 +01:00
										 |  |  |         if(this._swtch.data){ | 
					
						
							|  |  |  |             return this._upstream.Render(); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-06-10 01:36:20 +02:00
										 |  |  |         return undefined; | 
					
						
							| 
									
										
										
										
											2021-01-04 04:06:21 +01:00
										 |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  | } |