PixiJS Loader & AbortController: Unresolved Cancellation Handling
0 reputation · 15 Apr 2025, 21:59 UTC
Goal: Gracefully Cancel Asset Loads
PixiJS Loader is used to fetch textures and other assets in a web application. The current public API does not expose an abort method; developers must manually cancel the underlying XHR or Fetch request. When an asset load is aborted, the Loader’s onError callback is not invoked, leading to silent failures that are hard to diagnose.
Uncertainty
There is no built‑in timeout mechanism in the Loader, so requests can hang indefinitely unless the application implements its own logic. The interaction between PixiJS Loader, the browser’s AbortController, and the onError event is not clearly documented, and an open GitHub issue suggests this behavior remains unresolved.
Specific Questions
- Does PixiJS Loader internally expose the XHR or Fetch object so that an
AbortControllercan be attached and itsabort()method reliably trigger theonErrorcallback? - What is the recommended pattern for implementing a request timeout that guarantees the Loader’s error handling path is executed?
- Are there version‑specific differences (e.g., pre‑v6 versus v6+) that affect how cancellation should be handled?