hey guys when im looping and creating the cards for my grid i wanted a way to preload the textures so the 1st time the grid is loaded it already had the textures in cache…
what i found is that textureSourceHashmap handles that stuff… i think… but how can inject? i have a src, w and h is there a method that i can call to have the texturesource and stuff?
Is the grid the first screen coming up? I assume you just want to avoid the time it takes to get the images from the network? You might be able to just fetch the images so the browser will keep it in browser cache so when you do load it in Lightning its just pulling it from browser cache.
If you load the image in Lightning it will take up memory. And Lightning has optimizations to not load images until its visible on screen. You could override that and create all the image textures and then when you create them again Lightning will reuse the same image already in memory.
Let me know if you have more details or code to go through.
and i have x categories every time i focus a category i reload the grid with the new items
on _focus in a category images who are being fetched for the first time and converted into textures take a big longer but on repeat they are instant…
(even if i just fetch all the images… the first time they will be displayed on the grid will make the same behavihour because it doesnt have the texture saved yet)
my objective is to preload all the srcs textures…
those categories are populated in a map and inside that map i have the following condition
//if its a unique url call a function with the src
if (!image_list.includes(product.thumbnail)) {
image_list.push(product.thumbnail)
this.unique_src(product.thumbnail)
}
and when i call the unique_src function i wanted to use the img src and use it to add the texture in memory
is there a way to use the src to create a texture and add it to the memory?