I draw an image on a canvas with a text, but the canvas takes a long time to render. I want to be alerted once the canvas is rendered. This is my script :
function dz_res_click() {
var canvas = document.getElementById("dz_residence_canvas");
var context = canvas.getContext("2d");
var residence = new Image();
residence.src = "../../imgs/residence.jpg"
var r_wlaya = document.getElementById("r_wlaya").value;
residence.onload = function() {
context.drawImage(residence, 0, 0, 2135, 2843);
context.font = "bold 70px sans-serif";
context.textAlign = "right";
context.fillText(r_wlaya, 1596, 252);
}
}