[ Leksykon ] [ JavaScript ] [ Metody ] [ Właściwości ] [ Zdarzenia ] [ canvas ] [ HTMLCanvasElement() ]
HTMLCanvasElement.webglcontextlost
[_] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z]
Przykłady:
addEventListener("webglcontextlost", (event) => {});
onwebglcontextlost = (event) => {};
<script>
window.onload = () => {
const szer = 400;
const wys = 200;
const canvas2 = document.createElement("canvas");
canvas2.width = szer;
canvas2.height = wys
const ctx = canvas2.getContext("2d");
console.log(ctx);
const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");
canvas.addEventListener("webglcontextlost", (event) => {
console.log(event);
});
// Rejestrowane jest zdarzenie "webglcontextlost"
gl.getExtension("WEBGL_lose_context").loseContext();
return;
};
</script>
<canvas id="canvas" width="100" height="100"></canvas>
Opis:
Zdarzenie HTMLCanvasElement.webglcontextlost jest uruchamiane, jeśli klient użytkownika wykryje, że bufor rysowania powiązany z WebGLRenderingContext obiektem został utracony. Użyj nazwy zdarzenia w metodach takich jak addEventListener() lub ustaw właściwość obsługi zdarzeń. Typ wydarzenia WebGLContextEvent. Dziedziczy od Event.
Event <- WebGLContextEvent
Interfejs ten dziedziczy właściwości z interfejsu nadrzędnego, Event. WebGLContextEvent.statusMessage właściwość tylko do odczytu zawierająca dodatkowe informacje o zdarzeniu.
Zobacz też:
addEventListener() -
Event -
loseContext() - pozwala symulować utratę kontekstu kontekstu WebGLRenderingContext
WebGLContextEvent -
WebGLContextEvent.statusMessage - Właściwość tylko do odczytu zawierająca dodatkowe informacje o zdarzeniu
WEBGL_lose_context -
WebGLRenderingContext -