Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e8367d80
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e8367d80
编写于
3月 23, 2022
作者:
Z
zengyawen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update docs
Signed-off-by:
N
zengyawen
<
zengyawen1@huawei.com
>
上级
aa045e6b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
49 deletion
+49
-49
zh-cn/application-dev/reference/apis/js-apis-request.md
zh-cn/application-dev/reference/apis/js-apis-request.md
+49
-49
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-request.md
浏览文件 @
e8367d80
...
@@ -150,10 +150,10 @@ on(type: 'progress', callback:(uploadedSize: number, totalSize: number) => vo
...
@@ -150,10 +150,10 @@ on(type: 'progress', callback:(uploadedSize: number, totalSize: number) => 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) => void): void
...
@@ -171,7 +171,7 @@ on(type: 'headerReceive', callback: (header: object) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 订阅的事件类型,取值为'headerReceive'(接收响应头)。 |
| type | string | 是 | 订阅的事件类型,取值为'headerReceive'(接收响应头)。 |
| callback |
header:
object
| 是 | HTTP
Response
Header事件的回调函数。 |
| callback |
function
| 是 | HTTP
Response
Header事件的回调函数。 |
回调函数的参数:
回调函数的参数:
...
@@ -182,10 +182,10 @@ on(type: 'headerReceive', callback: (header: object) => void): void
...
@@ -182,10 +182,10 @@ on(type: 'headerReceive', callback: (header: object) => 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) => void): void
...
@@ -236,7 +236,7 @@ off(type: 'headerReceive', callback?: (header: object) => void): void
| 参数名 | 参数类型 | 必填 | 说明 |
| 参数名 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 取消订阅的事件类型,取值为'headerReceive'(接收响应头)。 |
| type | string | 是 | 取消订阅的事件类型,取值为'headerReceive'(接收响应头)。 |
| callback |
header:
object
| 否 | HTTP
Response
Header事件的回调函数。 |
| callback |
function
| 否 | HTTP
Response
Header事件的回调函数。 |
回调函数的参数:
回调函数的参数:
...
@@ -247,10 +247,10 @@ off(type: 'headerReceive', callback?: (header: object) => void): void
...
@@ -247,10 +247,10 @@ off(type: 'headerReceive', callback?: (header: object) => 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) => vo
...
@@ -449,11 +449,11 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) => 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) =>
...
@@ -489,11 +489,11 @@ off(type: 'progress', callback?: (receivedSize: number, totalSize: number) =>
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:() => void): void
...
@@ -522,11 +522,11 @@ on(type: 'complete', callback:() => 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?:() => void): void
...
@@ -555,11 +555,11 @@ off(type: 'complete', callback?:() => 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) => void): void
...
@@ -594,11 +594,11 @@ on(type: 'fail', callback: (err: number) => 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) => void): void
...
@@ -633,11 +633,11 @@ off(type: 'fail', callback?: (err: number) => 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:() => void): void
...
@@ -666,11 +666,11 @@ on(type: 'pause', callback:() => 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?:() => void): void
...
@@ -699,11 +699,11 @@ off(type: 'pause', callback?:() => 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:() => void): void
...
@@ -732,11 +732,11 @@ on(type: 'remove', callback:() => 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?:() => void): void
...
@@ -764,11 +764,11 @@ off(type: 'remove', callback?:() => 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录