forked from MapComplete/MapComplete
		
	Cleanup ToSvelte component
This commit is contained in:
		
							parent
							
								
									cd735c1571
								
							
						
					
					
						commit
						b1b4e6acba
					
				
					 1 changed files with 13 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -1,17 +1,18 @@
 | 
			
		|||
<script lang="ts">
 | 
			
		||||
  import BaseUIElement from "../BaseUIElement.js";
 | 
			
		||||
  import { onMount } from "svelte";
 | 
			
		||||
  import BaseUIElement from "../BaseUIElement.js"
 | 
			
		||||
  import { onMount } from "svelte"
 | 
			
		||||
 | 
			
		||||
  export let construct: BaseUIElement | (() => BaseUIElement)
 | 
			
		||||
  let elem: HTMLElement
 | 
			
		||||
 | 
			
		||||
  export let construct: BaseUIElement | (() => BaseUIElement);
 | 
			
		||||
  let elem: HTMLElement;
 | 
			
		||||
  onMount(() => {
 | 
			
		||||
    let html: HTMLElement
 | 
			
		||||
    if (typeof construct === "function") {
 | 
			
		||||
      html = construct().ConstructElement();
 | 
			
		||||
    } else {
 | 
			
		||||
      html = construct.ConstructElement();
 | 
			
		||||
    }
 | 
			
		||||
    let html =
 | 
			
		||||
      typeof construct === "function"
 | 
			
		||||
        ? construct().ConstructElement()
 | 
			
		||||
        : construct.ConstructElement()
 | 
			
		||||
 | 
			
		||||
    elem.replaceWith(html)
 | 
			
		||||
  });
 | 
			
		||||
  })
 | 
			
		||||
</script>
 | 
			
		||||
<span bind:this={elem}></span>
 | 
			
		||||
 | 
			
		||||
<span bind:this={elem} />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue