forked from MapComplete/MapComplete
		
	Huge refactoring: split readonly and writable stores
This commit is contained in:
		
							parent
							
								
									0946d8ac9c
								
							
						
					
					
						commit
						4283b76f36
					
				
					 95 changed files with 819 additions and 625 deletions
				
			
		|  | @ -1,23 +1,22 @@ | |||
| import {InputElement} from "./InputElement"; | ||||
| import {UIEventSource} from "../../Logic/UIEventSource"; | ||||
| import {InputElement, ReadonlyInputElement} from "./InputElement"; | ||||
| import {Store} from "../../Logic/UIEventSource"; | ||||
| import BaseUIElement from "../BaseUIElement"; | ||||
| import {VariableUiElement} from "../Base/VariableUIElement"; | ||||
| 
 | ||||
| export default class VariableInputElement<T> extends InputElement<T> { | ||||
| export default class VariableInputElement<T> extends BaseUIElement implements ReadonlyInputElement<T> { | ||||
| 
 | ||||
|     private readonly value: UIEventSource<T>; | ||||
|     private readonly value: Store<T>; | ||||
|     private readonly element: BaseUIElement | ||||
|     private readonly upstream: UIEventSource<InputElement<T>>; | ||||
| 
 | ||||
|     constructor(upstream: UIEventSource<InputElement<T>>) { | ||||
|     private readonly upstream: Store<InputElement<T>>; | ||||
| 
 | ||||
|     constructor(upstream: Store<InputElement<T>>) { | ||||
|         super() | ||||
|         this.upstream = upstream; | ||||
|         this.value = upstream.bind(v => v.GetValue()) | ||||
|         this.element = new VariableUiElement(upstream) | ||||
|     } | ||||
| 
 | ||||
|     GetValue(): UIEventSource<T> { | ||||
|     GetValue(): Store<T> { | ||||
|         return this.value; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue