const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");
canvas.addEventListener("webglcontextlost", (event) => {
console.log(event);
});
gl.getExtension("WEBGL_lose_context").loseContext();
// "webglcontextlost" event is logged.HTMLCanvasElement: webglcontextlost event / notebook
HTMLCanvasElement: webglcontextlost event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.