Skip to content

Commit 979810b

Browse files
committed
Remove polyfills
1 parent d8c79f6 commit 979810b

17 files changed

+6
-4143
lines changed

components/Fetch.onPress.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

components/Fetch.when.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

index.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import URIUtil from './utils/uri'
2121
import fs from './fs'
2222
import getUUID from './utils/uuid'
2323
import base64 from 'base-64'
24-
import polyfill from './polyfill'
2524
import _ from 'lodash'
2625
import android from './android'
2726
import ios from './ios'
@@ -42,7 +41,6 @@ const {
4241
cp
4342
} = fs
4443

45-
const Blob = polyfill.Blob
4644
const emitter = DeviceEventEmitter
4745
const RNFetchBlob = NativeModules.RNFetchBlob
4846

@@ -264,12 +262,6 @@ function fetch(...args:any):Promise {
264262
}
265263
})
266264

267-
// When the request body comes from Blob polyfill, we should use special its ref
268-
// as the request body
269-
if( body instanceof Blob && body.isRNFetchBlobPolyfill) {
270-
body = body.getRNFetchBlobRef()
271-
}
272-
273265
let req = RNFetchBlob[nativeMethodName]
274266

275267
/**
@@ -431,18 +423,17 @@ class FetchBlobResponse {
431423
* @return {Promise<Blob>} Return a promise resolves Blob object.
432424
*/
433425
this.blob = ():Promise<Blob> => {
434-
let Blob = polyfill.Blob
435426
let cType = info.headers['Content-Type'] || info.headers['content-type']
436427
return new Promise((resolve, reject) => {
437428
switch(this.type) {
438429
case 'base64':
439-
Blob.build(this.data, { type : cType + ';BASE64' }).then(resolve)
430+
resolve(new Blob([this.data], { type : cType + ';BASE64' }))
440431
break
441432
case 'path':
442-
polyfill.Blob.build(wrap(this.data), { type : cType }).then(resolve)
433+
resolve(new Blob([wrap(this.data)], { type : cType }))
443434
break
444435
default:
445-
polyfill.Blob.build(this.data, { type : 'text/plain' }).then(resolve)
436+
resolve(new Blob([this.data], { type : 'text/plain' }))
446437
break
447438
}
448439
})
@@ -561,6 +552,5 @@ export default {
561552
session,
562553
fs,
563554
wrap,
564-
polyfill,
565555
JSONStream
566556
}

json-stream.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
import Oboe from './lib/oboe-browser.min.js'
2-
import XMLHttpRequest from './polyfill/XMLHttpRequest'
1+
import Oboe from 'oboe'
32
import URIUtil from './utils/uri'
43

54
const OboeExtended = (arg: string | Object) => {
65

76

87
window.location = ''
98

10-
if(!window.XMLHttpRequest.isRNFBPolyfill ) {
11-
window.XMLHttpRequest = XMLHttpRequest
12-
console.warn(
13-
'Use JSONStream will automatically replace window.XMLHttpRequest with RNFetchBlob.polyfill.XMLHttpRequest. ' +
14-
'You are seeing this warning because you did not replace it manually.'
15-
)
16-
}
17-
189
if(typeof arg === 'string') {
1910
if(URIUtil.isFileURI(arg)) {
2011
arg = {

0 commit comments

Comments
 (0)