File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 2929
3030 if ( global . fetch && global . Request ) {
3131 loadImage . fetchBlob = function ( url , callback , options ) {
32+ /**
33+ * Fetch response handler.
34+ *
35+ * @param {Response } response Fetch response
36+ * @returns {Blob } Fetched Blob.
37+ */
38+ function responseHandler ( response ) {
39+ return response . blob ( )
40+ }
3241 if ( global . Promise && typeof callback !== 'function' ) {
33- return fetch ( new Request ( url , callback ) ) . then ( function ( response ) {
34- return response . blob ( )
35- } )
42+ return fetch ( new Request ( url , callback ) ) . then ( responseHandler )
3643 }
3744 fetch ( new Request ( url , options ) )
38- . then ( function ( response ) {
39- return response . blob ( )
40- } )
45+ . then ( responseHandler )
4146 . then ( callback )
4247 [
4348 // Avoid parsing error in IE<9, where catch is a reserved word.
You can’t perform that action at this time.
0 commit comments