Decode images asynchronously (#4320)

This commit is contained in:
Abdo 2025-09-17 09:06:42 +03:00 committed by GitHub
parent 6854d13b88
commit 75d9026be5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,6 +10,9 @@ export function allImagesLoaded(): Promise<void[]> {
} }
function imageLoaded(img: HTMLImageElement): Promise<void> { function imageLoaded(img: HTMLImageElement): Promise<void> {
if (!img.getAttribute("decoding")) {
img.decoding = "async";
}
return img.complete return img.complete
? Promise.resolve() ? Promise.resolve()
: new Promise((resolve) => { : new Promise((resolve) => {