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 2525} ) ( function ( loadImage ) {
2626 'use strict'
2727
28- if ( typeof fetch !== 'undefined' && typeof Request !== 'undefined' ) {
28+ var global = loadImage . global
29+
30+ if ( global . fetch && global . Request ) {
2931 loadImage . fetchBlob = function ( url , callback , options ) {
3032 fetch ( new Request ( url , options ) )
3133 . then ( function ( response ) {
3638 callback ( null , err )
3739 } )
3840 }
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
4443 loadImage . fetchBlob = function ( url , callback , options ) {
4544 // eslint-disable-next-line no-param-reassign
4645 options = options || { }
Original file line number Diff line number Diff line change 25182518
25192519 describe ( 'Fetch' , function ( ) {
25202520 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 )
25232523 ) {
25242524 return
25252525 }
You can’t perform that action at this time.
0 commit comments