提交 42c545c4 编写于 作者: A anyueling

request示例代码自动化检测问题修复

Signed-off-by: Nanyueling <anyueling@huawei.com>
上级 1f1c76d4
......@@ -18,14 +18,16 @@ import request from '@ohos.request';
默认支持https,如果要支持http,需要在config.json里增加network标签,属性标识 "cleartextTraffic": true。即:
```
var config = {
"deviceConfig": {
"default": {
"network": {
"cleartextTraffic": true
"cleartextTraffic":true
}
...
//...
}
}
}
```
......@@ -466,11 +468,10 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo
**示例:**
```js
downloadTask.on('progress', function download_callback(receivedSize, totalSize) {
downloadTask.on('progress', function download_callback(receivedSize, totalSize) {
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
}
);
});
```
......@@ -501,11 +502,10 @@ off(type: 'progress', callback?: (receivedSize: number, totalSize: number) =&gt;
**示例:**
```js
downloadTask .off('progress', function download_callback(receivedSize, totalSize) {
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
}
downloadTask .off('progress', function download_callback(receivedSize, totalSize) {
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
}
);
});
```
......@@ -529,11 +529,10 @@ on(type: 'complete'|'pause'|'remove', callback:() =&gt; void): void
**示例:**
```js
downloadTask.on('complete', function callback() {
console.info('Download task completed.');
}
downloadTask.on('complete', function callback() {
console.info('Download task completed.');
}
);
});
```
......@@ -557,11 +556,10 @@ off(type: 'complete'|'pause'|'remove', callback?:() =&gt; void): void
**示例:**
```js
downloadTask.off('complete', function callback() {
console.info('Download task completed.');
}
downloadTask.off('complete', function callback() {
console.info('Download task completed.');
}
);
});
```
......@@ -591,11 +589,10 @@ on(type: 'fail', callback: (err: number) =&gt; void): void
**示例:**
```js
downloadTask.on('fail', function callBack(err) {
console.info('Download task failed. Cause:' + err);
}
downloadTask.on('fail', function callBack(err) {
console.info('Download task failed. Cause:' + err);
}
);
});
```
......@@ -625,11 +622,10 @@ off(type: 'fail', callback?: (err: number) =&gt; void): void
**示例:**
```js
downloadTask.off('fail', function callBack(err) {
console.info('Download task failed. Cause:' + err);
}
downloadTask.off('fail', function callBack(err) {
console.info('Download task failed. Cause:' + err);
}
);
});
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册