File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed
Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,16 @@ class AssetRegistry extends EventHandler {
222222 this . _loader = loader ;
223223 }
224224
225+ /**
226+ * The ResourceLoader used to load asset files.
227+ *
228+ * @type {ResourceLoader }
229+ * @ignore
230+ */
231+ get loader ( ) {
232+ return this . _loader ;
233+ }
234+
225235 /**
226236 * Create a filtered list of assets from the registry.
227237 *
Original file line number Diff line number Diff line change @@ -116,6 +116,17 @@ class GSplatAssetLoader extends GSplatAssetLoaderBase {
116116 this . _retryCount . clear ( ) ;
117117 }
118118
119+ /**
120+ * Checks if the loader can start new loads. Returns false if the 'gsplat' handler
121+ * has been removed from the registry (e.g., during app destruction).
122+ *
123+ * @returns {boolean } True if loading is possible, false otherwise.
124+ * @private
125+ */
126+ _canLoad ( ) {
127+ return ! ! this . _registry . loader ?. getHandler ( 'gsplat' ) ;
128+ }
129+
119130 /**
120131 * Initiates loading of a gsplat asset. This is a fire-and-forget operation that starts
121132 * the loading process. Use getResource() later to check if the asset has finished loading.
@@ -217,8 +228,8 @@ class GSplatAssetLoader extends GSplatAssetLoaderBase {
217228 * @private
218229 */
219230 _onAssetLoadError ( url , asset , err ) {
220- // Don't process if destroyed or already unloaded
221- if ( this . _destroyed || ! this . _urlToAsset . has ( url ) ) {
231+ // Don't process if destroyed, handler removed, or already unloaded
232+ if ( this . _destroyed || ! this . _canLoad ( ) || ! this . _urlToAsset . has ( url ) ) {
222233 return ;
223234 }
224235
@@ -256,8 +267,8 @@ class GSplatAssetLoader extends GSplatAssetLoaderBase {
256267 * @private
257268 */
258269 _processQueue ( ) {
259- // Don't process queue if destroyed
260- if ( this . _destroyed ) {
270+ // Don't process queue if destroyed or handler removed
271+ if ( this . _destroyed || ! this . _canLoad ( ) ) {
261272 return ;
262273 }
263274
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { Debug } from '../../core/debug.js';
55 * GSplat asset loaders must implement.
66 *
77 * @category Asset
8+ * @ignore
89 */
910class GSplatAssetLoaderBase {
1011 /**
You can’t perform that action at this time.
0 commit comments