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 {
129
129
const req = new Request ( url , {
130
130
headers : new Headers ( this . requestHeader ) ,
131
131
credentials : this . withCredentials ? 'include' : 'same-origin' ,
132
- signal : this . _abortController . signal
132
+ signal : AbortSignal . any ( [ this . _abortController . signal , this . manager . abortController . signal ] )
133
133
} ) ;
134
134
135
135
// record states ( avoid data race )
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ class ImageBitmapLoader extends Loader {
162
162
const fetchOptions = { } ;
163
163
fetchOptions . credentials = ( this . crossOrigin === 'anonymous' ) ? 'same-origin' : 'include' ;
164
164
fetchOptions . headers = this . requestHeader ;
165
- fetchOptions . signal = this . _abortController . signal ;
165
+ fetchOptions . signal = AbortSignal . any ( [ this . _abortController . signal , this . manager . abortController . signal ] ) ;
166
166
167
167
const promise = fetch ( url , fetchOptions ) . then ( function ( res ) {
168
168
Original file line number Diff line number Diff line change @@ -82,12 +82,11 @@ class LoadingManager extends EventDispatcher {
82
82
this . onError = onError ;
83
83
84
84
/**
85
- * Whether loading requests can be aborted with { @link LoadingManager#abort} or not .
85
+ * Used for aborting ongoing requests in loaders using this manager .
86
86
*
87
- * @type {boolean }
88
- * @default false
87
+ * @type {AbortController }
89
88
*/
90
- this . enableAbortManagement = false ;
89
+ this . abortController = new AbortController ( ) ;
91
90
92
91
/**
93
92
* This should be called by any loader using the manager when the loader
@@ -291,15 +290,15 @@ class LoadingManager extends EventDispatcher {
291
290
292
291
/**
293
292
* 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}.
296
294
*
297
295
* @fires LoadingManager#abort
298
296
* @return {LoadingManager } A reference to this loading manager.
299
297
*/
300
298
this . abort = function ( ) {
301
299
302
- this . dispatchEvent ( _abort ) ;
300
+ this . abortController . abort ( ) ;
301
+ this . abortController = new AbortController ( ) ;
303
302
304
303
return this ;
305
304
You can’t perform that action at this time.
0 commit comments