提交 e8367d80 编写于 作者: Z zengyawen

update docs

Signed-off-by: Nzengyawen <zengyawen1@huawei.com>
上级 aa045e6b
...@@ -150,10 +150,10 @@ on(type: 'progress', callback:(uploadedSize: number, totalSize: number) =&gt; vo ...@@ -150,10 +150,10 @@ on(type: 'progress', callback:(uploadedSize: number, totalSize: number) =&gt; vo
- 示例: - 示例:
``` ```
uploadTask.on('progress', callback); uploadTask.on('progress', function callback(uploadedSize, totalSize) {
callback(uploadedSize, totalSize) {
console.info("upload totalSize:" + totalSize + " uploadedSize:" + uploadedSize); console.info("upload totalSize:" + totalSize + " uploadedSize:" + uploadedSize);
} }
);
``` ```
...@@ -171,7 +171,7 @@ on(type: 'headerReceive', callback: (header: object) =&gt; void): void ...@@ -171,7 +171,7 @@ on(type: 'headerReceive', callback: (header: object) =&gt; void): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 订阅的事件类型,取值为'headerReceive'(接收响应头)。 | | type | string | 是 | 订阅的事件类型,取值为'headerReceive'(接收响应头)。 |
| callback | header:&nbsp;object | 是 | HTTP&nbsp;Response&nbsp;Header事件的回调函数。 | | callback | function | 是 | HTTP&nbsp;Response&nbsp;Header事件的回调函数。 |
回调函数的参数: 回调函数的参数:
...@@ -182,10 +182,10 @@ on(type: 'headerReceive', callback: (header: object) =&gt; void): void ...@@ -182,10 +182,10 @@ on(type: 'headerReceive', callback: (header: object) =&gt; void): void
- 示例: - 示例:
``` ```
uploadTask.on('headerReceive', callback); uploadTask.on('headerReceive', function callback(headers){
callback(headers){
console.info("upOnHeader headers:" + JSON.stringify(headers)); console.info("upOnHeader headers:" + JSON.stringify(headers));
} }
);
``` ```
...@@ -215,10 +215,10 @@ off(type: 'progress', callback?: (uploadedSize: number, totalSize: number) =&g ...@@ -215,10 +215,10 @@ off(type: 'progress', callback?: (uploadedSize: number, totalSize: number) =&g
- 示例: - 示例:
``` ```
uploadTask.off('progress', callback); uploadTask.off('progress', function callback(uploadedSize, totalSize) {
callback(uploadedSize, totalSize) {
console.info('uploadedSize: ' + uploadedSize, 'totalSize: ' + totalSize); console.info('uploadedSize: ' + uploadedSize, 'totalSize: ' + totalSize);
} }
);
``` ```
...@@ -236,7 +236,7 @@ off(type: 'headerReceive', callback?: (header: object) =&gt; void): void ...@@ -236,7 +236,7 @@ off(type: 'headerReceive', callback?: (header: object) =&gt; void): void
| 参数名 | 参数类型 | 必填 | 说明 | | 参数名 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 取消订阅的事件类型,取值为'headerReceive'(接收响应头)。 | | type | string | 是 | 取消订阅的事件类型,取值为'headerReceive'(接收响应头)。 |
| callback | header:&nbsp;object | 否 | HTTP&nbsp;Response&nbsp;Header事件的回调函数。 | | callback | function | 否 | HTTP&nbsp;Response&nbsp;Header事件的回调函数。 |
回调函数的参数: 回调函数的参数:
...@@ -247,10 +247,10 @@ off(type: 'headerReceive', callback?: (header: object) =&gt; void): void ...@@ -247,10 +247,10 @@ off(type: 'headerReceive', callback?: (header: object) =&gt; void): void
- 示例: - 示例:
``` ```
uploadTask.off('headerReceive', callback); uploadTask.off('headerReceive', function callback(headers) {
callback(headers) {
console.info("upOnHeader headers:" + JSON.stringify(headers)); console.info("upOnHeader headers:" + JSON.stringify(headers));
} }
);
``` ```
...@@ -449,11 +449,11 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo ...@@ -449,11 +449,11 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo
return; return;
} }
downloadTask = data; downloadTask = data;
downloadTask.on('progress', download_callback); downloadTask.on('progress', function download_callback(receivedSize, totalSize) {
});
download_callback(receivedSize, totalSize) {
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize); console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
} }
);
});
``` ```
...@@ -489,11 +489,11 @@ off(type: 'progress', callback?: (receivedSize: number, totalSize: number) =&gt; ...@@ -489,11 +489,11 @@ off(type: 'progress', callback?: (receivedSize: number, totalSize: number) =&gt;
return; return;
} }
downloadTask = data; downloadTask = data;
downloadTask .off('progress', download_callback); downloadTask .off('progress', function download_callback(receivedSize, totalSize) {
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
}
);
}); });
download_callback(receivedSize, totalSize) {
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
}
``` ```
...@@ -522,11 +522,11 @@ on(type: 'complete', callback:() =&gt; void): void ...@@ -522,11 +522,11 @@ on(type: 'complete', callback:() =&gt; void): void
return; return;
} }
downloadTask= data; downloadTask= data;
downloadTask.on('complete',callback); downloadTask.on('complete', function callback() {
console.info('Download task completed.');
}
);
}); });
callback() {
console.info('Download task completed.');
}
``` ```
...@@ -555,11 +555,11 @@ off(type: 'complete', callback?:() =&gt; void): void ...@@ -555,11 +555,11 @@ off(type: 'complete', callback?:() =&gt; void): void
return; return;
} }
downloadTask = data; downloadTask = data;
downloadTask.off('complete',callback); downloadTask.off('complete', function callback() {
console.info('Download task completed.');
}
);
}); });
callback() {
console.info('Download task completed.');
}
``` ```
...@@ -594,11 +594,11 @@ on(type: 'fail', callback: (err: number) =&gt; void): void ...@@ -594,11 +594,11 @@ on(type: 'fail', callback: (err: number) =&gt; void): void
return; return;
} }
downloadTask = data; downloadTask = data;
downloadTask.on('fail', callBack); downloadTask.on('fail', function callBack(err) {
console.info('Download task failed. Cause:' + err);
}
);
}); });
callBack(err) {
console.info('Download task failed. Cause:' + err);
}
``` ```
...@@ -633,11 +633,11 @@ off(type: 'fail', callback?: (err: number) =&gt; void): void ...@@ -633,11 +633,11 @@ off(type: 'fail', callback?: (err: number) =&gt; void): void
return; return;
} }
downloadTask = data; downloadTask = data;
downloadTask.off('fail', callBack); downloadTask.off('fail', function callBack(err) {
console.info('Download task failed. Cause:' + err);
}
);
}); });
callBack(err) {
console.info('Download task failed. Cause:' + err);
}
``` ```
...@@ -666,11 +666,11 @@ on(type: 'pause', callback:() =&gt; void): void ...@@ -666,11 +666,11 @@ on(type: 'pause', callback:() =&gt; void): void
return; return;
} }
downloadTask = data; downloadTask = data;
downloadTask.on('pause', callBack); downloadTask.on('pause', function callBack() {
console.info('Download task paused.');
}
);
}); });
callBack() {
console.info('Download task paused.');
}
``` ```
...@@ -699,11 +699,11 @@ off(type: 'pause', callback?:() =&gt; void): void ...@@ -699,11 +699,11 @@ off(type: 'pause', callback?:() =&gt; void): void
return; return;
} }
downloadTask = data; downloadTask = data;
downloadTask.off('pause', callBack); downloadTask.off('pause', function callBack() {
console.info('Download task paused.');
}
);
}); });
callBack() {
console.info('Download task paused.');
}
``` ```
...@@ -732,11 +732,11 @@ on(type: 'remove', callback:() =&gt; void): void ...@@ -732,11 +732,11 @@ on(type: 'remove', callback:() =&gt; void): void
return; return;
} }
downloadTask = data; downloadTask = data;
downloadTask.on('remove', callBack); downloadTask.on('remove', function callBack() {
console.info('Download task removed.');
}
);
}); });
callBack() {
console.info('Download task removed.');
}
``` ```
...@@ -764,11 +764,11 @@ off(type: 'remove', callback?:() =&gt; void): void ...@@ -764,11 +764,11 @@ off(type: 'remove', callback?:() =&gt; void): void
console.error('Failed to remove the download task. Cause:' + JSON.stringify(err)); console.error('Failed to remove the download task. Cause:' + JSON.stringify(err));
} }
downloadTask = data; downloadTask = data;
downloadTask.off('remove', callBack); downloadTask.off('remove', function callBack() {
console.info('Download task removed.');
}
);
}); });
callBack() {
console.info('Download task removed.');
}
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册