const canvas = document.getElementById("canvas");
canvas.addEventListener("contextrestored", (e) => {
console.log(e);
// call to redrawCanvas() or similar
});HTMLCanvasElement: contextrestored event / notebook
HTMLCanvasElement: contextrestored event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.