Baseline Widely available
The webglcontextlost
event of the WebGL API is fired if the user agent detects that the drawing buffer associated with a WebGLRenderingContext
object has been lost.
This event does not bubble.
SyntaxUse the event name in methods like addEventListener()
, or set an event handler property.
addEventListener("webglcontextlost", (event) => { })
onwebglcontextlost = (event) => { }
Event type Event properties
This interface inherits properties from its parent interface, Event
.
WebGLContextEvent.statusMessage
A read-only property containing additional information about the event.
With the help of the WEBGL_lose_context
extension, you can simulate the webglcontextlost
event:
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.
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4