1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream)
- exports.writableStream = isFunction(global.WritableStream)
- exports.abortController = isFunction(global.AbortController)
- var xhr
- function getXHR () {
-
- if (xhr !== undefined) return xhr
- if (global.XMLHttpRequest) {
- xhr = new global.XMLHttpRequest()
-
-
-
- try {
- xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com')
- } catch(e) {
- xhr = null
- }
- } else {
-
- xhr = null
- }
- return xhr
- }
- function checkTypeSupport (type) {
- var xhr = getXHR()
- if (!xhr) return false
- try {
- xhr.responseType = type
- return xhr.responseType === type
- } catch (e) {}
- return false
- }
- exports.arraybuffer = exports.fetch || checkTypeSupport('arraybuffer')
- exports.msstream = !exports.fetch && checkTypeSupport('ms-stream')
- exports.mozchunkedarraybuffer = !exports.fetch && checkTypeSupport('moz-chunked-arraybuffer')
- exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false)
- function isFunction (value) {
- return typeof value === 'function'
- }
- xhr = null
|