WebGLContextEvent

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

Hinweis: Diese Funktion ist in Web Workers verfügbar.

Die WebGLContextEvent-Schnittstelle ist Teil der WebGL-API und dient als Schnittstelle für ein Ereignis, das als Reaktion auf eine Statusänderung im WebGL-Rendering-Kontext generiert wird.

Event WebGLContextEvent

Konstruktor

WebGLContextEvent()

Erstellt ein neues WebGLContextEvent-Objekt.

Instanzeigenschaften

Diese Schnittstelle erbt Eigenschaften von ihrer übergeordneten Schnittstelle, Event.

WebGLContextEvent.statusMessage

Eine schreibgeschützte Eigenschaft, die zusätzliche Informationen über das Ereignis enthält.

Instanzmethoden

Diese Schnittstelle definiert keine eigenen Methoden, erbt jedoch Methoden von ihrer übergeordneten Schnittstelle, Event.

Beispiele

Mit Hilfe der WEBGL_lose_context-Erweiterung können Sie die Ereignisse webglcontextlost und webglcontextrestored simulieren:

js
const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");

canvas.addEventListener(
  "webglcontextlost",
  (e) => {
    console.log(e);
  },
  false,
);

gl.getExtension("WEBGL_lose_context").loseContext();

// WebGLContextEvent event with type "webglcontextlost" is logged.

Spezifikationen

Specification
WebGL Specification
# 5.15

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
WebGLContextEvent
WebGLContextEvent() constructor
statusMessage
Available in workers
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

Siehe auch