UploadFileTask
UploadFileTask.abort
中断上传任务
参数
Object object
中断上传任务的回调函数
回调参数 Object res
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
complete | function |
否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function |
否 | 接口调用成功的回调函数 | |
fail | function |
否 | 接口调用失败的回调函数 |
函数定义示例
/**
* 中断上传任务
*/
export function abort(params: {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: () => void;
/** 接口调用成功的回调函数 */
success?: (params: null) => void;
failure?: (params: {
errorMsg: string;
errorCode: string | number;
innerError: {
errorCode: string | number;
errorMsg: string;
};
}) => void;
}): void;
UploadFileTask.onHeadersReceived
监听 HTTP Response Header 事件。会比请求完成事件更早
参数
function callback
监听 HTTP Response Header 事件。会比请求完成事件更早的回调函数
回调参数 Object res
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
header | any |
是 | 开发者服务器返回的 HTTP Response Header | |
requestId | string |
是 | 网络请求 id |