diff --git a/output/main.js b/output/main.js index 5345300..a29d4b2 100644 --- a/output/main.js +++ b/output/main.js @@ -44,6 +44,11 @@ const filteredCommunities = { ], }; +/** + * Hanging reference to preloaded images to avoid garbage collection. + */ +const preloadedImages = []; + // This can be achieved with `text-overflow: ellipsis` instead // and generated entirely server-side. const transformJoinURL = (join_link) => { @@ -134,8 +139,6 @@ function displayQRModal(communityID) { } function hideQRModal(communityID) { - dom.details_modal_room_icon().src = ""; - dom.details_modal_qr_code().src = ""; dom.details_modal().close(); } @@ -228,13 +231,17 @@ function preloadImages() { rowElement => rowElement.getAttribute(ATTRIBUTES.ROW.ROOM_ICON) ) for (const identifier of identifiers) { - (new Image()).src = communityQRCodeURL(identifier); + const image = new Image(); + image.src = communityQRCodeURL(identifier); + preloadedImages.push(image); } for (const icon of icons) { if (!icon) { continue; } - (new Image()).src = icon; + const image = new Image(); + image.src = icon; + preloadedImages.push(image); } }