1681-engine / index / watchContextLoss
Function: watchContextLoss() ​
ts
function watchContextLoss(
canvas,
onLost,
options?
): () => void;Defined in: src/diagnostics/contextLoss.ts:48
Calls onLost with a verdict each time canvas (the renderer's) loses its WebGL context; the game tears its world down and rebuilds it after delayMs, or shows an error when giveUp. The event's default is prevented, which is what lets the browser restore the context at all. Returns the uninstall.
Parameters ​
| Parameter | Type |
|---|---|
canvas | EventTarget |
onLost | (verdict) => void |
options | ContextLossPolicy & object |
Returns ​
() => void