123456789101112131415161718192021222324252627282930313233343536373839404142 |
- ;(function (factory) {
- 'use strict'
- if (typeof define === 'function' && define.amd) {
-
- define(['./load-image', './load-image-meta'], factory)
- } else if (typeof module === 'object' && module.exports) {
- factory(require('./load-image'), require('./load-image-meta'))
- } else {
-
- factory(window.loadImage)
- }
- }(function (loadImage) {
- 'use strict'
- if ('fetch' in window && 'Request' in window) {
- loadImage.fetchBlob = function (url, callback, options) {
- if (loadImage.hasMetaOption(options)) {
- return fetch(new Request(url, options)).then(function (response) {
- return response.blob()
- }).then(callback).catch(function (err) {
- console.log(err)
- callback()
- })
- } else {
- callback()
- }
- }
- }
- }))
|