DEV Community

Discussion on: Loading Images with Web Workers

Collapse
 
monochromer profile image
monochromer • Edited

Don't forget about URL.revokeObjectURL(objectURL)

imageElement.onload = () => {
    imageElement.removeAttribute('data-src')
    URL.revokeObjectURL(objectURL);    
  }
Enter fullscreen mode Exit fullscreen mode

This techinque can be used as polyfill for imageElement.decode()

Collapse
 
trezy profile image
Trezy

That's a great callout, @monochromer ! I updated the article with that piece of information. 🥰