|
@@ -196,11 +196,11 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
|
196
|
196
|
})
|
197
|
197
|
.fetch(_method, _url, _headers, body)
|
198
|
198
|
this._task
|
199
|
|
- .stateChange(this._headerReceived.bind(this))
|
200
|
|
- .uploadProgress(this._uploadProgressEvent.bind(this))
|
201
|
|
- .progress(this._progressEvent.bind(this))
|
202
|
|
- .catch(this._onError.bind(this))
|
203
|
|
- .then(this._onDone.bind(this))
|
|
199
|
+ .stateChange(this._headerReceived)
|
|
200
|
+ .uploadProgress(this._uploadProgressEvent)
|
|
201
|
+ .progress(this._progressEvent)
|
|
202
|
+ .catch(this._onError)
|
|
203
|
+ .then(this._onDone)
|
204
|
204
|
|
205
|
205
|
})
|
206
|
206
|
}
|
|
@@ -274,7 +274,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
|
274
|
274
|
return result.substr(0, result.length-2)
|
275
|
275
|
}
|
276
|
276
|
|
277
|
|
- _headerReceived(e) {
|
|
277
|
+ _headerReceived = (e) => {
|
278
|
278
|
log.debug('header received ', this._task.taskId, e)
|
279
|
279
|
this.responseURL = this._url
|
280
|
280
|
if(e.state === "2") {
|
|
@@ -285,7 +285,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
|
285
|
285
|
}
|
286
|
286
|
}
|
287
|
287
|
|
288
|
|
- _uploadProgressEvent(send:number, total:number) {
|
|
288
|
+ _uploadProgressEvent = (send:number, total:number) => {
|
289
|
289
|
if(!this._uploadStarted) {
|
290
|
290
|
this.upload.dispatchEvent('loadstart')
|
291
|
291
|
this._uploadStarted = true
|
|
@@ -295,7 +295,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
|
295
|
295
|
this.upload.dispatchEvent('progress', new ProgressEvent(true, send, total))
|
296
|
296
|
}
|
297
|
297
|
|
298
|
|
- _progressEvent(send:number, total:number, chunk:string) {
|
|
298
|
+ _progressEvent = (send:number, total:number, chunk:string) => {
|
299
|
299
|
log.verbose(this.readyState)
|
300
|
300
|
if(this._readyState === XMLHttpRequest.HEADERS_RECEIVED)
|
301
|
301
|
this._dispatchReadStateChange(XMLHttpRequest.LOADING)
|
|
@@ -310,7 +310,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
|
310
|
310
|
this.dispatchEvent('progress', e)
|
311
|
311
|
}
|
312
|
312
|
|
313
|
|
- _onError(err) {
|
|
313
|
+ _onError = (err) => {
|
314
|
314
|
let statusCode = Math.floor(this.status)
|
315
|
315
|
if(statusCode >= 100 && statusCode !== 408) {
|
316
|
316
|
return
|
|
@@ -331,7 +331,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget{
|
331
|
331
|
this.clearEventListeners()
|
332
|
332
|
}
|
333
|
333
|
|
334
|
|
- _onDone(resp) {
|
|
334
|
+ _onDone = (resp) => {
|
335
|
335
|
log.debug('XMLHttpRequest done', this._url, resp, this)
|
336
|
336
|
this._statusText = this._status
|
337
|
337
|
let responseDataReady = () => {
|