From 617adace59a559d545b7e16fef0b2bbf00173586 Mon Sep 17 00:00:00 2001 From: choelzl Date: Wed, 23 Feb 2022 20:57:23 +0100 Subject: [PATCH] WIP --- web/emotewall/index.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) 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; }