diff --git a/web/emotewall/index.js b/web/emotewall/index.js index 2258949..cf3fe0b 100644 --- a/web/emotewall/index.js +++ b/web/emotewall/index.js @@ -89,7 +89,7 @@ $(async function () { preloaded = false; var loadedimages = {}; for (let i=0; i { - let loadcount = 0; - let loadtotal = emotesId.length; - var localPreloaded = false; + const promiseArray = []; for (let i=0; i { + const image = new Image(); + image.onload = () => resolve(); + image.src = "https://static-cdn.jtvnw.net/emoticons/v2/" + emotesId[i] + "/default/dark/2.0"; + img_map[emotesId[i]] = image; + })); } - await waitFor(_ => localPreloaded === true); + await Promise.all(promiseArray); return true; }