提交 f6d6eab7 编写于 作者: 雪洛's avatar 雪洛

fix: uploadTask abort失效的Bug askId: 99364

上级 e8f14edc
......@@ -12,32 +12,32 @@ class UploadTask {
this.id = uploadTaskId
this._callbackId = callbackId
this._callbacks = []
}
}
abort () {
invokeMethod('operateRequestTask', {
invokeMethod('operateUploadTask', {
uploadTaskId: this.id,
operationType: 'abort'
})
}
}
onProgressUpdate (callback) {
if (typeof callback !== 'function') {
return
}
this._callbacks.push(callback)
}
}
onHeadersReceived () {
}
}
offProgressUpdate (callback) {
const index = this._callbacks.indexOf(callback)
if (index >= 0) {
this._callbacks.splice(index, 1)
}
}
}
offHeadersReceived () {
......@@ -79,7 +79,7 @@ onMethod('onUploadTaskStateChange', ({
errMsg: 'request:fail ' + errMsg
})
// eslint-disable-next-line no-fallthrough
default:
default:
// progressUpdate 可能晚于 success
setTimeout(() => {
delete uploadTasks[uploadTaskId]
......@@ -94,4 +94,4 @@ export function uploadFile (args, callbackId) {
const task = new UploadTask(uploadTaskId, callbackId)
uploadTasks[uploadTaskId] = task
return task
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册