/ Gists / Img.decode() // nahrada za onload()
On gists

Img.decode() // nahrada za onload()

JavaScript

img-decode.js Raw #

const img = document.querySelector('img')
const tempImg = new Image()

tempImg.src = 'https://masoprofit.cz/storage/images/1600x2000/41847.png.webp'

tempImg.decode().then(() => {
  img.src = tempImg.src
}).catch(e => {
  console.log(e)
})