forked from MapComplete/MapComplete
		
	
		
			
	
	
		
			16 lines
		
	
	
	
		
			440 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			16 lines
		
	
	
	
		
			440 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 
								 | 
							
								import BaseUIElement from "../BaseUIElement";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export default class Lazy extends BaseUIElement{
							 | 
						||
| 
								 | 
							
								    private readonly _f: () => BaseUIElement;
							 | 
						||
| 
								 | 
							
								    
							 | 
						||
| 
								 | 
							
								    constructor(f: () => BaseUIElement) {
							 | 
						||
| 
								 | 
							
								        super();
							 | 
						||
| 
								 | 
							
								        this._f = f;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    
							 | 
						||
| 
								 | 
							
								    protected InnerConstructElement(): HTMLElement {
							 | 
						||
| 
								 | 
							
								        // The caching of the BaseUIElement will guarantee that _f will only be called once
							 | 
						||
| 
								 | 
							
								        return this._f().ConstructElement();
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    
							 | 
						||
| 
								 | 
							
								}
							 |