File tree Expand file tree Collapse file tree 3 files changed +8
-9
lines changed
Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ class FileLoader extends Loader {
129129 const req = new Request ( url , {
130130 headers : new Headers ( this . requestHeader ) ,
131131 credentials : this . withCredentials ? 'include' : 'same-origin' ,
132- signal : this . _abortController . signal
132+ signal : AbortSignal . any ( [ this . _abortController . signal , this . manager . abortController . signal ] )
133133 } ) ;
134134
135135 // record states ( avoid data race )
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ class ImageBitmapLoader extends Loader {
162162 const fetchOptions = { } ;
163163 fetchOptions . credentials = ( this . crossOrigin === 'anonymous' ) ? 'same-origin' : 'include' ;
164164 fetchOptions . headers = this . requestHeader ;
165- fetchOptions . signal = this . _abortController . signal ;
165+ fetchOptions . signal = AbortSignal . any ( [ this . _abortController . signal , this . manager . abortController . signal ] ) ;
166166
167167 const promise = fetch ( url , fetchOptions ) . then ( function ( res ) {
168168
Original file line number Diff line number Diff line change @@ -82,12 +82,11 @@ class LoadingManager extends EventDispatcher {
8282 this . onError = onError ;
8383
8484 /**
85- * Whether loading requests can be aborted with { @link LoadingManager#abort} or not .
85+ * Used for aborting ongoing requests in loaders using this manager .
8686 *
87- * @type {boolean }
88- * @default false
87+ * @type {AbortController }
8988 */
90- this . enableAbortManagement = false ;
89+ this . abortController = new AbortController ( ) ;
9190
9291 /**
9392 * This should be called by any loader using the manager when the loader
@@ -291,15 +290,15 @@ class LoadingManager extends EventDispatcher {
291290
292291 /**
293292 * 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}.
293+ * The abort only works if the loaders implement {@link Loader#abort}.
296294 *
297295 * @fires LoadingManager#abort
298296 * @return {LoadingManager } A reference to this loading manager.
299297 */
300298 this . abort = function ( ) {
301299
302- this . dispatchEvent ( _abort ) ;
300+ this . abortController . abort ( ) ;
301+ this . abortController = new AbortController ( ) ;
303302
304303 return this ;
305304
You can’t perform that action at this time.
0 commit comments