Thread viewer for Bluesky
at 2.0 21 lines 421 B view raw
1<script lang="ts"> 2 let { loading, error, ...props } = $props(); 3 let imageState: string | undefined = $state(); 4 5 function onload() { 6 imageState = 'loaded'; 7 } 8 9 function onerror() { 10 imageState = 'error'; 11 } 12</script> 13 14{#if !imageState} 15 {@render loading()} 16 <img {...props} style="display: none" {onload} {onerror}> 17{:else if imageState == 'loaded'} 18 <img {...props}> 19{:else} 20 {@render error()} 21{/if}