Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
Why Svelte's onDestroy event is not executing URL.revokeObjectURL()?

I've been loading modal with a help of svelte-simple-modal library, and I want to cleanup variable used for loading image that is stored in memory, previously obtained from backend through JSON.

So I have these important things in tag of Modal.svelte (component which loads with modal window):

arrayBufferCover = base64ToArrayBuffer(response[0].details[0].cover);
blob = new Blob([arrayBufferCover], {type: "image/jpeg"});
blobCoverURL = URL.createObjectURL(blob);
onDestroy(() => URL.revokeObjectURL(blobCoverURL));

And this is what I have in HTML section of Modal.svelte:

<img alt="cover" src={blobCoverURL} />

onDestroy event is occuring after modal window is closed, I'm totally sure it does, but when I check in console, I still have multiple objects listed in sources section (everytime I open modal one object is made). Contrary to that, the list of objects I get from chrome://blob-internals/ is periodically getting smaller, which may be meaning cleanup is properly done, just that Sources in Console is not refreshed, but I'm really not sure, especially because IDs I see comparing those two reports are different?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda