• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

187
Views
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 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error