|
@@ -202,8 +202,8 @@ function fetch(...args:any):Promise {
|
202
|
202
|
let count = -1
|
203
|
203
|
let fn = () => {}
|
204
|
204
|
if(args.length === 2) {
|
205
|
|
- interval = args[0].interval
|
206
|
|
- interval = args[0].count
|
|
205
|
+ interval = args[0].interval || interval
|
|
206
|
+ count = args[0].count || count
|
207
|
207
|
fn = args[1]
|
208
|
208
|
}
|
209
|
209
|
else {
|
|
@@ -218,8 +218,8 @@ function fetch(...args:any):Promise {
|
218
|
218
|
let count = -1
|
219
|
219
|
let fn = () => {}
|
220
|
220
|
if(args.length === 2) {
|
221
|
|
- interval = args[0].interval
|
222
|
|
- interval = args[0].count
|
|
221
|
+ interval = args[0].interval || interval
|
|
222
|
+ count = args[0].count || count
|
223
|
223
|
fn = args[1]
|
224
|
224
|
}
|
225
|
225
|
else {
|
|
@@ -276,6 +276,24 @@ class FetchBlobResponse {
|
276
|
276
|
this.info = ():RNFetchBlobResponseInfo => {
|
277
|
277
|
return this.respInfo
|
278
|
278
|
}
|
|
279
|
+
|
|
280
|
+ this.array = ():Promise<Array> => {
|
|
281
|
+ let cType = info.headers['Content-Type'] || info.headers['content-type']
|
|
282
|
+ return new Promise((resolve, reject) => {
|
|
283
|
+ switch(this.type) {
|
|
284
|
+ case 'base64':
|
|
285
|
+ // TODO : base64 to array buffer
|
|
286
|
+ break
|
|
287
|
+ case 'path':
|
|
288
|
+ fs.readFile(this.data, 'ascii').then(resolve)
|
|
289
|
+ break
|
|
290
|
+ default:
|
|
291
|
+ // TODO : text to array buffer
|
|
292
|
+ break
|
|
293
|
+ }
|
|
294
|
+ })
|
|
295
|
+ }
|
|
296
|
+
|
279
|
297
|
/**
|
280
|
298
|
* Convert result to javascript RNFetchBlob object.
|
281
|
299
|
* @return {Promise<Blob>} Return a promise resolves Blob object.
|