emptygif
Idioma: Português

Todas as linguagens e frameworks

Svelte component Svelte

Um snippet em Svelte para Svelte component que responde às requisições para /pixel.gif com o GIF vazio, decodificado uma única vez na inicialização.

Svelte component Svelte

Arquivo
Spacer.svelte
<script>
  const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';

  let { width = 1, height = 1, ...rest } = $props();
</script>

<img src={EMPTY_GIF} {width} {height} alt="" aria-hidden="true" {...rest} />

Executamos este snippet e comparamos os bytes que ele retornou.

Site oficial: Svelte component