We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3f36f16 commit ab93b1bCopy full SHA for ab93b1b
1 file changed
js/load-image-fetch.js
@@ -29,15 +29,20 @@
29
30
if (global.fetch && global.Request) {
31
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
+ }
41
if (global.Promise && typeof callback !== 'function') {
- return fetch(new Request(url, callback)).then(function (response) {
- return response.blob()
- })
42
+ return fetch(new Request(url, callback)).then(responseHandler)
43
}
44
fetch(new Request(url, options))
- .then(function (response) {
45
+ .then(responseHandler)
46
.then(callback)
47
[
48
// Avoid parsing error in IE<9, where catch is a reserved word.
0 commit comments