If I pass the reference to an image to drawImage API of HTML canvas, but the image is still loading, then what would happen? Will get an exception, or the API will go ahead with the partial data, or the API will block till the image is loaded?
If I pass the reference to an image to drawImage API of HTML canvas
Share
The canvas spec dictates that nothing shall be drawn, even if it is 99% loaded. It does not throw an error.
So if you do:
This is why most people do something similar to:
To ensure that the image will get drawn.