Skip to content

1681-engine / index / guardRender

Function: guardRender() ​

ts
function guardRender(
   app, 
   onFail, 
   failures?
): () => void;

Defined in: src/diagnostics/renderGuard.ts:16

Replaces Pixi's render on the ticker with one that survives a throw and reports a renderer that keeps failing. A ticker listener that throws never asks for the next frame, and Stage's per-step guard covers the game's steps, not the renderer's: a render that threw on its first frame froze the canvas in silence while the page went on. A single bad frame is let go; failures in a row are reported once. Returns the uninstall, which puts Pixi's own render back.

Parameters ​

ParameterTypeDefault value
appApplicationundefined
onFail(detail, err) => voidundefined
failuresnumber30

Returns ​

() => void

Released under the MIT License.