Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
37b6a529
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
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看板
提交
37b6a529
编写于
5月 05, 2023
作者:
X
xujie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
js-docs整改
Signed-off-by:
N
xujie
<
xujie223@huawei.com
>
上级
5ed0c454
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
59 addition
and
59 deletion
+59
-59
zh-cn/application-dev/reference/apis/js-apis-http.md
zh-cn/application-dev/reference/apis/js-apis-http.md
+5
-5
zh-cn/application-dev/reference/apis/js-apis-net-connection.md
.../application-dev/reference/apis/js-apis-net-connection.md
+24
-24
zh-cn/application-dev/reference/apis/js-apis-socket.md
zh-cn/application-dev/reference/apis/js-apis-socket.md
+30
-30
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-http.md
浏览文件 @
37b6a529
...
...
@@ -68,7 +68,7 @@ httpRequest.request(
> **说明:**
> console.info()输出的数据中包含换行符会导致数据出现截断现象。
## http.createHttp
## http.createHttp
<sup>6+</sup>
createHttp(): HttpRequest
...
...
@@ -94,7 +94,7 @@ let httpRequest = http.createHttp();
HTTP请求任务。在调用HttpRequest的方法前,需要先通过
[
createHttp()
](
#httpcreatehttp
)
创建一个任务。
### request
### request
<sup>6+</sup>
request(url: string, callback: AsyncCallback
\<
HttpResponse
\>
):void
...
...
@@ -145,7 +145,7 @@ httpRequest.request("EXAMPLE_URL", (err, data) => {
});
```
### request
### request
<sup>6+</sup>
request(url: string, options: HttpRequestOptions, callback: AsyncCallback
\<
HttpResponse
\>
):void
...
...
@@ -231,7 +231,7 @@ httpRequest.request("EXAMPLE_URL",
});
```
### request
### request
<sup>6+</sup>
request(url: string, options? : HttpRequestOptions): Promise
\<
HttpResponse
\>
...
...
@@ -1028,7 +1028,7 @@ httpResponseCache.delete().then(() => {
});
```
## HttpDataType<sup>
9
+</sup>
## HttpDataType<sup>
6
+</sup>
http的数据类型。
...
...
zh-cn/application-dev/reference/apis/js-apis-net-connection.md
浏览文件 @
37b6a529
...
...
@@ -444,7 +444,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.getAllNets<sup>
9
+</sup>
## connection.getAllNets<sup>
8
+</sup>
getAllNets(callback: AsyncCallback
<
Array
<
NetHandle
>>
): void
...
...
@@ -477,7 +477,7 @@ connection.getAllNets(function (error, data) {
});
```
## connection.getAllNets<sup>
9
+</sup>
## connection.getAllNets<sup>
8
+</sup>
getAllNets(): Promise
<
Array
<
NetHandle
>>
...
...
@@ -509,7 +509,7 @@ connection.getAllNets().then(function (data) {
});
```
## connection.getConnectionProperties<sup>
9
+</sup>
## connection.getConnectionProperties<sup>
8
+</sup>
getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback
\<
ConnectionProperties>): void
...
...
@@ -547,7 +547,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.getConnectionProperties<sup>
9
+</sup>
## connection.getConnectionProperties<sup>
8
+</sup>
getConnectionProperties(netHandle: NetHandle): Promise
\<
ConnectionProperties>
...
...
@@ -589,7 +589,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.getNetCapabilities<sup>
9
+</sup>
## connection.getNetCapabilities<sup>
8
+</sup>
getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback
\<
NetCapabilities>): void
...
...
@@ -627,7 +627,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.getNetCapabilities<sup>
9
+</sup>
## connection.getNetCapabilities<sup>
8
+</sup>
getNetCapabilities(netHandle: NetHandle): Promise
\<
NetCapabilities>
...
...
@@ -734,7 +734,7 @@ connection.isDefaultNetMetered().then(function (data) {
})
```
## connection.hasDefaultNet<sup>
9
+</sup>
## connection.hasDefaultNet<sup>
8
+</sup>
hasDefaultNet(callback: AsyncCallback
\<
boolean>): void
...
...
@@ -767,7 +767,7 @@ connection.hasDefaultNet(function (error, data) {
})
```
## connection.hasDefaultNet<sup>
9
+</sup>
## connection.hasDefaultNet<sup>
8
+</sup>
hasDefaultNet(): Promise
\<
boolean>
...
...
@@ -799,7 +799,7 @@ connection.hasDefaultNet().then(function (data) {
})
```
## connection.enableAirplaneMode<sup>
9
+</sup>
## connection.enableAirplaneMode<sup>
8
+</sup>
enableAirplaneMode(callback: AsyncCallback
\<
void>): void
...
...
@@ -832,7 +832,7 @@ connection.enableAirplaneMode(function (error) {
})
```
## connection.enableAirplaneMode<sup>
9
+</sup>
## connection.enableAirplaneMode<sup>
8
+</sup>
enableAirplaneMode(): Promise
\<
void>
...
...
@@ -865,7 +865,7 @@ connection.enableAirplaneMode().then(function (error) {
})
```
## connection.disableAirplaneMode<sup>
9
+</sup>
## connection.disableAirplaneMode<sup>
8
+</sup>
disableAirplaneMode(callback: AsyncCallback
\<
void>): void
...
...
@@ -898,7 +898,7 @@ connection.disableAirplaneMode(function (error) {
})
```
## connection.disableAirplaneMode<sup>
9
+</sup>
## connection.disableAirplaneMode<sup>
8
+</sup>
disableAirplaneMode(): Promise
\<
void>
...
...
@@ -931,7 +931,7 @@ connection.disableAirplaneMode().then(function (error) {
})
```
## connection.reportNetConnected<sup>
9
+</sup>
## connection.reportNetConnected<sup>
8
+</sup>
reportNetConnected(netHandle: NetHandle, callback: AsyncCallback
<
void
>
): void
...
...
@@ -968,7 +968,7 @@ connection.getDefaultNet().then(function (netHandle) {
});
```
## connection.reportNetConnected<sup>
9
+</sup>
## connection.reportNetConnected<sup>
8
+</sup>
reportNetConnected(netHandle: NetHandle): Promise
<
void
>
...
...
@@ -1009,7 +1009,7 @@ connection.getDefaultNet().then(function (netHandle) {
});
```
## connection.reportNetDisconnected<sup>
9
+</sup>
## connection.reportNetDisconnected<sup>
8
+</sup>
reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback
<
void
>
): void
...
...
@@ -1046,7 +1046,7 @@ connection.getDefaultNet().then(function (netHandle) {
});
```
## connection.reportNetDisconnected<sup>
9
+</sup>
## connection.reportNetDisconnected<sup>
8
+</sup>
reportNetDisconnected(netHandle: NetHandle): Promise
<
void
>
...
...
@@ -1087,7 +1087,7 @@ connection.getDefaultNet().then(function (netHandle) {
});
```
## connection.getAddressesByName<sup>
9
+</sup>
## connection.getAddressesByName<sup>
8
+</sup>
getAddressesByName(host: string, callback: AsyncCallback
\<
Array
\<
NetAddress>>): void
...
...
@@ -1124,7 +1124,7 @@ connection.getAddressesByName(host, function (error, data) {
})
```
## connection.getAddressesByName<sup>
9
+</sup>
## connection.getAddressesByName<sup>
8
+</sup>
getAddressesByName(host: string): Promise
\<
Array
\<
NetAddress>>
...
...
@@ -1174,7 +1174,7 @@ connection.getAddressesByName(host).then(function (data) {
> 设备从有网络到无网络状态会触发netLost事件;
> 设备从WiFi到蜂窝会触发netLost事件(WiFi丢失)之后触发 netAvaliable事件(蜂窝可用);
### register<sup>
10
+</sup>
### register<sup>
8
+</sup>
register(callback: AsyncCallback
\<
void>): void
...
...
@@ -1208,7 +1208,7 @@ netConnection.register(function (error) {
})
```
### unregister<sup>
10
+</sup>
### unregister<sup>
8
+</sup>
unregister(callback: AsyncCallback
\<
void>): void
...
...
@@ -1640,7 +1640,7 @@ connection.getDefaultNet().then((netHandle) => {
})
```
### getAddressesByName<sup>
9
+</sup>
### getAddressesByName<sup>
8
+</sup>
getAddressesByName(host: string, callback: AsyncCallback
\<
Array
\<
NetAddress>>): void
...
...
@@ -1679,7 +1679,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
### getAddressesByName<sup>
9
+</sup>
### getAddressesByName<sup>
8
+</sup>
getAddressesByName(host: string): Promise
\<
Array
\<
NetAddress>>
...
...
@@ -1722,7 +1722,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
### getAddressByName<sup>
9
+</sup>
### getAddressByName<sup>
8
+</sup>
getAddressByName(host: string, callback: AsyncCallback
\<
NetAddress>): void
...
...
@@ -1761,7 +1761,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
### getAddressByName<sup>
9
+</sup>
### getAddressByName<sup>
8
+</sup>
getAddressByName(host: string): Promise
\<
NetAddress>
...
...
zh-cn/application-dev/reference/apis/js-apis-socket.md
浏览文件 @
37b6a529
...
...
@@ -12,7 +12,7 @@
import
socket
from
'
@ohos.net.socket
'
;
```
## socket.constructUDPSocketInstance<sup>
9
+</sup>
## socket.constructUDPSocketInstance<sup>
7
+</sup>
constructUDPSocketInstance(): UDPSocket
...
...
@@ -32,11 +32,11 @@ constructUDPSocketInstance(): UDPSocket
let
udp
=
socket
.
constructUDPSocketInstance
();
```
## UDPSocket<sup>
9
+</sup>
## UDPSocket<sup>
7
+</sup>
UDPSocket连接。在调用UDPSocket的方法前,需要先通过
[
socket.constructUDPSocketInstance
](
#socketconstructudpsocketinstance
)
创建UDPSocket对象。
### bind<sup>
9
+</sup>
### bind<sup>
7
+</sup>
bind(address: NetAddress, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -73,7 +73,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
})
```
### bind<sup>
9
+</sup>
### bind<sup>
7
+</sup>
bind(address: NetAddress): Promise
\<
void
\>
...
...
@@ -114,7 +114,7 @@ promise.then(() => {
});
```
### send<sup>
9
+</sup>
### send<sup>
7
+</sup>
send(options: UDPSendOptions, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -160,7 +160,7 @@ udp.send({
})
```
### send<sup>
9
+</sup>
### send<sup>
7
+</sup>
send(options: UDPSendOptions): Promise
\<
void
\>
...
...
@@ -210,7 +210,7 @@ promise.then(() => {
});
```
### close<sup>
9
+</sup>
### close<sup>
7
+</sup>
close(callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -239,7 +239,7 @@ udp.close(err => {
})
```
### close<sup>
9
+</sup>
### close<sup>
7
+</sup>
close(): Promise
\<
void
\>
...
...
@@ -267,7 +267,7 @@ promise.then(() => {
});
```
### getState<sup>
9
+</sup>
### getState<sup>
7
+</sup>
getState(callback: AsyncCallback
\<
SocketStateBase
\>
): void
...
...
@@ -312,7 +312,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
})
```
### getState<sup>
9
+</sup>
### getState<sup>
7
+</sup>
getState(): Promise
\<
SocketStateBase
\>
...
...
@@ -351,7 +351,7 @@ promise.then(err => {
});
```
### setExtraOptions<sup>
9
+</sup>
### setExtraOptions<sup>
7
+</sup>
setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -404,7 +404,7 @@ udp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => {
})
```
### setExtraOptions<sup>
9
+</sup>
### setExtraOptions<sup>
7
+</sup>
setExtraOptions(options: UDPExtraOptions): Promise
\<
void
\>
...
...
@@ -460,7 +460,7 @@ promise.then(() => {
});
```
### on('message')<sup>
9
+</sup>
### on('message')<sup>
7
+</sup>
on(type: 'message', callback: Callback
\<
{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}
\>
): void
...
...
@@ -491,7 +491,7 @@ udp.on('message', value => {
});
```
### off('message')<sup>
9
+</sup>
### off('message')<sup>
7
+</sup>
off(type: 'message', callback?: Callback
\<
{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}
\>
): void
...
...
@@ -529,7 +529,7 @@ udp.off('message', callback);
udp
.
off
(
'
message
'
);
```
### on('listening' | 'close')<sup>
9
+</sup>
### on('listening' | 'close')<sup>
7
+</sup>
on(type: 'listening' | 'close', callback: Callback
\<
void
\>
): void
...
...
@@ -556,7 +556,7 @@ udp.on('close', () => {
});
```
### off('listening' | 'close')<sup>
9
+</sup>
### off('listening' | 'close')<sup>
7
+</sup>
off(type: 'listening' | 'close', callback?: Callback
\<
void
\>
): void
...
...
@@ -594,7 +594,7 @@ udp.off('close', callback2);
udp
.
off
(
'
close
'
);
```
### on('error')<sup>
9
+</sup>
### on('error')<sup>
7
+</sup>
on(type: 'error', callback: ErrorCallback): void
...
...
@@ -618,7 +618,7 @@ udp.on('error', err => {
});
```
### off('error')<sup>
9
+</sup>
### off('error')<sup>
7
+</sup>
off(type: 'error', callback?: ErrorCallback): void
...
...
@@ -649,7 +649,7 @@ udp.off('error', callback);
udp
.
off
(
'
error
'
);
```
## NetAddress<sup>
9
+</sup>
## NetAddress<sup>
7
+</sup>
目标地址信息。
...
...
@@ -661,7 +661,7 @@ udp.off('error');
| port | number | 否 | 端口号 ,范围0~65535。如果不指定系统随机分配端口。 |
| family | number | 否 | 网络协议类型,可选类型:
<br
/>
- 1:IPv4
<br
/>
- 2:IPv6
<br
/>
默认为1。 |
## UDPSendOptions<sup>
9
+</sup>
## UDPSendOptions<sup>
7
+</sup>
UDPSocket发送参数。
...
...
@@ -672,7 +672,7 @@ UDPSocket发送参数。
| data | string
\|
ArrayBuffer
<sup>
7+
</sup>
| 是 | 发送的数据。 |
| address |
[
NetAddress
](
#netaddress
)
| 是 | 目标地址信息。 |
## UDPExtraOptions<sup>
9
+</sup>
## UDPExtraOptions<sup>
7
+</sup>
UDPSocket连接的其他属性。
...
...
@@ -686,7 +686,7 @@ UDPSocket连接的其他属性。
| reuseAddress | boolean | 否 | 是否重用地址。默认为false。 |
| socketTimeout | number | 否 | 套接字超时时间,单位毫秒(ms)。 |
## SocketStateBase<sup>
9
+</sup>
## SocketStateBase<sup>
7
+</sup>
Socket的状态信息。
...
...
@@ -698,7 +698,7 @@ Socket的状态信息。
| isClose | boolean | 是 | 是否关闭。 |
| isConnected | boolean | 是 | 是否连接。 |
## SocketRemoteInfo<sup>
9
+</sup>
## SocketRemoteInfo<sup>
7
+</sup>
Socket的连接信息。
...
...
@@ -717,7 +717,7 @@ UDP 其余错误码映射形式为:2301000 + Linux内核错误码。
错误码的详细介绍参见
[
Socket错误码
](
../errorcodes/errorcode-net-socket.md
)
## socket.constructTCPSocketInstance<sup>
9
+</sup>
## socket.constructTCPSocketInstance<sup>
7
+</sup>
constructTCPSocketInstance(): TCPSocket
...
...
@@ -1869,7 +1869,7 @@ promise.then(() => {
});
```
### on('message')
### on('message')
<sup>9+</sup>
on(type: 'message', callback: Callback
<
{
message:
ArrayBuffer
,
remoteInfo:
SocketRemoteInfo
}
>
): void;
...
...
@@ -1900,7 +1900,7 @@ tls.on('message', value => {
});
```
### off('message')
### off('message')
<sup>9+</sup>
off(type: 'message', callback?: Callback
\<
{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}
\>
): void
...
...
@@ -1936,7 +1936,7 @@ tls.on('message', callback);
// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
tls
.
off
(
'
message
'
,
callback
);
```
### on('connect' | 'close')
### on('connect' | 'close')
<sup>9+</sup>
on(type: 'connect' | 'close', callback: Callback
\<
void
\>
): void
...
...
@@ -1963,7 +1963,7 @@ tls.on('close', () => {
});
```
### off('connect' | 'close')
### off('connect' | 'close')
<sup>9+</sup>
off(type: 'connect' | 'close', callback?: Callback
\<
void
\>
): void
...
...
@@ -2000,7 +2000,7 @@ tls.on('close', callback2);
tls
.
off
(
'
close
'
,
callback2
);
```
### on('error')
### on('error')
<sup>9+</sup>
on(type: 'error', callback: ErrorCallback): void
...
...
@@ -2024,7 +2024,7 @@ tls.on('error', err => {
});
```
### off('error')
### off('error')
<sup>9+</sup>
off(type: 'error', callback?: ErrorCallback): void
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录