This repository was archived by the owner on Feb 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 25
25
} ) ( function ( loadImage ) {
26
26
'use strict'
27
27
28
- if ( typeof fetch !== 'undefined' && typeof Request !== 'undefined' ) {
28
+ var global = loadImage . global
29
+
30
+ if ( global . fetch && global . Request ) {
29
31
loadImage . fetchBlob = function ( url , callback , options ) {
30
32
fetch ( new Request ( url , options ) )
31
33
. then ( function ( response ) {
36
38
callback ( null , err )
37
39
} )
38
40
}
39
- } else if (
40
- // Check for XHR2 support:
41
- typeof XMLHttpRequest !== 'undefined' &&
42
- typeof ProgressEvent !== 'undefined'
43
- ) {
41
+ } else if ( global . XMLHttpRequest && global . ProgressEvent ) {
42
+ // Browser supports XHR Level 2 and XHR responseType blob
44
43
loadImage . fetchBlob = function ( url , callback , options ) {
45
44
// eslint-disable-next-line no-param-reassign
46
45
options = options || { }
Original file line number Diff line number Diff line change 2518
2518
2519
2519
describe ( 'Fetch' , function ( ) {
2520
2520
if (
2521
- ! ( ' fetch' in window && 'Request' in window ) &&
2522
- ! ( ' XMLHttpRequest' in window && 'ProgressEvent' in window )
2521
+ ! ( window . fetch && window . Request ) &&
2522
+ ! ( window . XMLHttpRequest && window . ProgressEvent )
2523
2523
) {
2524
2524
return
2525
2525
}
You can’t perform that action at this time.
0 commit comments