1- import { EventDispatcher } from '../core/EventDispatcher.js' ;
2-
3- /**
4- * Fires when {@link LoadingManager#abort} is called.
5- *
6- * @event LoadingManager#abort
7- * @type {Object }
8- */
9- const _abort = { type : 'abort' } ;
10-
111/**
122 * Handles and keeps track of loaded and pending data. A default global
133 * instance of this class is created and used by loaders if not supplied
@@ -25,7 +15,7 @@ const _abort = { type: 'abort' };
2515 * const loader2 = new ColladaLoader( manager );
2616 * ```
2717 */
28- class LoadingManager extends EventDispatcher {
18+ class LoadingManager {
2919
3020 /**
3121 * Constructs a new loading manager.
@@ -36,8 +26,6 @@ class LoadingManager extends EventDispatcher {
3626 */
3727 constructor ( onLoad , onProgress , onError ) {
3828
39- super ( ) ;
40-
4129 const scope = this ;
4230
4331 let isLoading = false ;
@@ -82,12 +70,11 @@ class LoadingManager extends EventDispatcher {
8270 this . onError = onError ;
8371
8472 /**
85- * Whether loading requests can be aborted with { @link LoadingManager#abort} or not .
73+ * Used for aborting ongoing requests in loaders using this manager .
8674 *
87- * @type {boolean }
88- * @default false
75+ * @type {AbortController }
8976 */
90- this . enableAbortManagement = false ;
77+ this . abortController = new AbortController ( ) ;
9178
9279 /**
9380 * This should be called by any loader using the manager when the loader
@@ -291,15 +278,15 @@ class LoadingManager extends EventDispatcher {
291278
292279 /**
293280 * Can be used to abort ongoing loading requests in loaders using this manager.
294- * The abort only works if {@link LoadingManager#enableAbortManagement} is set
295- * to `true` and the loaders implement {@link Loader#abort}.
281+ * The abort only works if the loaders implement {@link Loader#abort}.
296282 *
297283 * @fires LoadingManager#abort
298284 * @return {LoadingManager } A reference to this loading manager.
299285 */
300286 this . abort = function ( ) {
301287
302- this . dispatchEvent ( _abort ) ;
288+ this . abortController . abort ( ) ;
289+ this . abortController = new AbortController ( ) ;
303290
304291 return this ;
305292
0 commit comments