Created
May 30, 2019 17:38
-
-
Save thedvlprs/1c5e1ddd1549bfe9a151b4d35a5443de to your computer and use it in GitHub Desktop.
Ускорение загрузки страницы за счёт параллельной загрузки картинок, вместо последовательной
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async ()=>{ | |
for (let node of document.getElementsByTagName('img')) { | |
await new Promise(res=>{ | |
node.src=node.dataset.src; | |
node.onload = ()=>res(); | |
}) | |
} | |
})() | |
// Используется data-src вместо src | |
// Ускорение загрузки страницы за счёт параллельной загрузки картинок, вместо последовательной. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment