better error handling and performance improvements

This commit is contained in:
ld3zian 2025-01-28 18:49:06 -07:00
parent 6ca77cf6af
commit 17ceea25d9
6 changed files with 87 additions and 23 deletions

View file

@ -75,3 +75,10 @@ export function getRandomBackground(): BackgroundImage {
}
return backgrounds[Math.floor(Math.random() * backgrounds.length)];
}
export function preloadBackgrounds() {
backgrounds.forEach(bg => {
const img = new Image();
img.src = bg.url;
});
}