Refresh image cache to obscure activity

dev
gravel 2 years ago
parent 648820b381
commit 1863429411
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -49,7 +49,7 @@ const filteredCommunities = {
/** /**
* Hanging reference to preloaded images to avoid garbage collection. * Hanging reference to preloaded images to avoid garbage collection.
*/ */
const preloadedImages = []; let preloadedImages = [];
/** /**
* Create an interactive version of the Community join link. * Create an interactive version of the Community join link.
@ -134,6 +134,9 @@ function onLoad() {
addQRModalHandlers(); addQRModalHandlers();
addServerIconInteractions(); addServerIconInteractions();
preloadImages(); preloadImages();
setInterval(() => {
preloadImages();
}, 60 * 60E3);
reactToURLParameters(); reactToURLParameters();
addInformativeInteractions(); addInformativeInteractions();
} }
@ -320,6 +323,7 @@ function addQRModalHandlers() {
* Prefetches images used in the page to prevent tracking. * Prefetches images used in the page to prevent tracking.
*/ */
function preloadImages() { function preloadImages() {
const preloadedImagesNew = [];
const rows = dom.tbl_communities_content_rows(); const rows = dom.tbl_communities_content_rows();
const identifiers = rows.map( const identifiers = rows.map(
rowElement => rowElement.getAttribute(ATTRIBUTES.ROW.IDENTIFIER) rowElement => rowElement.getAttribute(ATTRIBUTES.ROW.IDENTIFIER)
@ -338,8 +342,9 @@ function preloadImages() {
} }
const image = new Image(); const image = new Image();
image.src = icon; image.src = icon;
preloadedImages.push(image); preloadedImagesNew.push(image);
} }
preloadedImages = preloadedImagesNew;
} }
/** /**

Loading…
Cancel
Save