I keep reading that images are already loaded asynchronously, or to use onload
(which doesn't solve the problem). When loading a large image, specifically from canvas.toDataURL()
, the whole page freezes while the image is being loaded.
What I'm doing specifically is prerendering a procedurally generated map (for a game) in a hidden canvas, then loading that data into an image to draw faster. The actual problem is setting the src, which happens even if I just img.src=img.src
to invoke loading again.
Is there any way at all to make large images load over time instead of all at once and causing this huge disruption?