The **inputDeviceCooperate** module enables two or more networked devices to share the keyboard and mouse for collaborative operations.
The **inputDeviceCooperate** module implements screen hopping for two or more networked devices to share the keyboard and mouse for collaborative operations.
> **NOTE**
> **NOTE**
>
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs provided by this module are system APIs.
>
> - The APIs provided by this module are system APIs.
## Modules to Import
## Modules to Import
...
@@ -66,7 +66,7 @@ Specifies whether to enable screen hopping. This API uses a promise to return th
...
@@ -66,7 +66,7 @@ Specifies whether to enable screen hopping. This API uses a promise to return th
The **cooperate** module implements screen hopping for two or more networked devices to share the keyboard and mouse for collaborative operations.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module are system APIs.
| type | string | Yes | Event type. The value is **cooperate**.|
| callback | AsyncCallback<void> | No | Callback to be unregistered. If this parameter is not specified, all callbacks registered by the current application will be unregistered.|
connectTimeout:60000// Optional. The default value is 60000, in ms.
connectTimeout:60000// Optional. The default value is 60000, in ms.
readTimeout:60000,// Optional. The default value is 60000, in ms.
readTimeout:60000,// Optional. The default value is 60000, in ms.
usingProtocol:http.HttpProtocol.HTTP1_1,// Optional. The default protocol type is automatically specified by the system.
usingProtocol:http.HttpProtocol.HTTP1_1,// Optional. The default protocol type is automatically specified by the system.
usingProxy:false,// Optional. By default, network proxy is not used. This field is supported since API 10.
usingProxy:false,// Optional. By default, network proxy is not used. This field is supported since API version 10.
caPath:"",// Optional. The preset CA certificate is used by default. This field is supported since API version 10.
},(err,data)=>{
},(err,data)=>{
if(!err){
if(!err){
// data.result carries the HTTP response. Parse the response based on service requirements.
// data.result carries the HTTP response. Parse the response based on service requirements.
...
@@ -68,7 +69,7 @@ httpRequest.request(
...
@@ -68,7 +69,7 @@ httpRequest.request(
> **NOTE**
> **NOTE**
> If the data in **console.info()** contains a newline character, the data will be truncated.
> If the data in **console.info()** contains a newline character, the data will be truncated.
## http.createHttp
## http.createHttp<sup>6+</sup>
createHttp(): HttpRequest
createHttp(): HttpRequest
...
@@ -94,7 +95,7 @@ let httpRequest = http.createHttp();
...
@@ -94,7 +95,7 @@ let httpRequest = http.createHttp();
Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp()](#httpcreatehttp) to create an **HttpRequestTask** object.
Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp()](#httpcreatehttp) to create an **HttpRequestTask** object.
Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
on(type: 'dataProgress', callback: AsyncCallback\<{ receiveSize: number, totalSize: number }\>): void
on(type: 'dataProgress', callback: Callback\<{ receiveSize: number, totalSize: number }\>): void
Registers an observer for events indicating progress of receiving HTTP streaming responses.
Registers an observer for events indicating progress of receiving HTTP streaming responses.
...
@@ -802,7 +851,7 @@ Unregisters the observer for events indicating progress of receiving HTTP stream
...
@@ -802,7 +851,7 @@ Unregisters the observer for events indicating progress of receiving HTTP stream
httpRequest.off('dataProgress');
httpRequest.off('dataProgress');
```
```
## HttpRequestOptions
## HttpRequestOptions<sup>6+</sup>
Specifies the type and value range of the optional parameters in the HTTP request.
Specifies the type and value range of the optional parameters in the HTTP request.
...
@@ -819,9 +868,10 @@ Specifies the type and value range of the optional parameters in the HTTP reques
...
@@ -819,9 +868,10 @@ Specifies the type and value range of the optional parameters in the HTTP reques
| readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms.<br>The value **0** indicates no timeout.|
| readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms.<br>The value **0** indicates no timeout.|
| connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. |
| connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. |
| usingProtocol<sup>9+</sup> | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. |
| usingProtocol<sup>9+</sup> | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. |
| usingProxy<sup>10+</sup> | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.<br>- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.<br>- If **usingProxy** is of the **object** type, the specified network proxy is used. |
| usingProxy<sup>10+</sup> | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.<br>- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.<br>- If **usingProxy** is of the **object** type, the specified network proxy is used.
| caPath<sup>10+</sup> | string | No | Path of the CA certificate. If this parameter is set, the system uses the CA certificate in the specified path. Otherwise, the system uses the preset CA certificate. |
## RequestMethod
## RequestMethod<sup>6+</sup>
Defines an HTTP request method.
Defines an HTTP request method.
...
@@ -838,7 +888,7 @@ Defines an HTTP request method.
...
@@ -838,7 +888,7 @@ Defines an HTTP request method.
| TRACE | "TRACE" | TRACE method. |
| TRACE | "TRACE" | TRACE method. |
| CONNECT | "CONNECT" | CONNECT method.|
| CONNECT | "CONNECT" | CONNECT method.|
## ResponseCode
## ResponseCode<sup>6+</sup>
Enumerates the response codes for an HTTP request.
Enumerates the response codes for an HTTP request.
...
@@ -882,7 +932,7 @@ Enumerates the response codes for an HTTP request.
...
@@ -882,7 +932,7 @@ Enumerates the response codes for an HTTP request.
| GATEWAY_TIMEOUT | 504 | "Gateway Timeout." The server acting as a gateway or proxy does not receive requests from the remote server within the timeout period. |
| GATEWAY_TIMEOUT | 504 | "Gateway Timeout." The server acting as a gateway or proxy does not receive requests from the remote server within the timeout period. |
| VERSION | 505 | "HTTP Version Not Supported." The server does not support the HTTP protocol version used in the request. |
| VERSION | 505 | "HTTP Version Not Supported." The server does not support the HTTP protocol version used in the request. |
@@ -1174,7 +1178,7 @@ Represents the network connection handle.
...
@@ -1174,7 +1178,7 @@ Represents the network connection handle.
> When a device changes to the network disconnected state, the **netLost** event will be triggered.
> When a device changes to the network disconnected state, the **netLost** event will be triggered.
> When a device switches from a Wi-Fi network to a cellular network, the **netLost** event will be first triggered to indicate that the Wi-Fi network is lost and then the **netAvaliable** event will be triggered to indicate that the cellular network is available.
> When a device switches from a Wi-Fi network to a cellular network, the **netLost** event will be first triggered to indicate that the Wi-Fi network is lost and then the **netAvaliable** event will be triggered to indicate that the cellular network is available.
### register
### register<sup>8+</sup>
register(callback: AsyncCallback\<void>): void
register(callback: AsyncCallback\<void>): void
...
@@ -1195,9 +1199,10 @@ Registers a listener for network status changes.
...
@@ -1195,9 +1199,10 @@ Registers a listener for network status changes.
| ID| Error Message |
| ID| Error Message |
| ------- | ----------------------------- |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
| 2100003 | System internal error. |
| 2101008 | The callback is not exists. |
| 2101008 | The same callback exists. |
| 2101022 | The number of requests exceeded the maximum. |
| 2101022 | The number of requests exceeded the maximum. |
@@ -1818,7 +1825,7 @@ Defines the network capability.
...
@@ -1818,7 +1825,7 @@ Defines the network capability.
| NET_CAPABILITY_NOT_VPN | 15 | The network does not use a virtual private network (VPN).|
| NET_CAPABILITY_NOT_VPN | 15 | The network does not use a virtual private network (VPN).|
| NET_CAPABILITY_VALIDATED | 16 | The Internet access capability of the network is successfully verified by the connection management module.|
| NET_CAPABILITY_VALIDATED | 16 | The Internet access capability of the network is successfully verified by the connection management module.|
## NetBearType
## NetBearType<sup>8+</sup>
Enumerates network types.
Enumerates network types.
...
@@ -1842,7 +1849,7 @@ Defines the global HTTP proxy configuration of the network.
...
@@ -1842,7 +1849,7 @@ Defines the global HTTP proxy configuration of the network.
| port | number | No | Host port.|
| port | number | No | Host port.|
| exclusionList | Array<string> | No | Exclusion list of hosts that do not use the proxy server. The length of the combined elements in the list cannot exceed 96 bytes.<br>For example, the length of **baidu.com,zhihu.com** is 20 bytes.|
| exclusionList | Array<string> | No | Exclusion list of hosts that do not use the proxy server. The length of the combined elements in the list cannot exceed 96 bytes.<br>For example, the length of **baidu.com,zhihu.com** is 20 bytes.|
## NetSpecifier
## NetSpecifier<sup>8+</sup>
Provides an instance that bears data network capabilities.
Provides an instance that bears data network capabilities.
...
@@ -1853,7 +1860,7 @@ Provides an instance that bears data network capabilities.
...
@@ -1853,7 +1860,7 @@ Provides an instance that bears data network capabilities.
| netCapabilities | [NetCapabilities](#netcapabilities) | Yes | Network transmission capabilities and bearer types of the data network. |
| netCapabilities | [NetCapabilities](#netcapabilities) | Yes | Network transmission capabilities and bearer types of the data network. |
| bearerPrivateIdentifier | string | No | Network identifier. The identifier of a Wi-Fi network is **wifi**, and that of a cellular network is **slot0** (corresponding to SIM card 1).|
| bearerPrivateIdentifier | string | No | Network identifier. The identifier of a Wi-Fi network is **wifi**, and that of a cellular network is **slot0** (corresponding to SIM card 1).|
## NetCapabilities
## NetCapabilities<sup>8+</sup>
Defines the network capability set.
Defines the network capability set.
...
@@ -1866,7 +1873,7 @@ Defines the network capability set.
...
@@ -1866,7 +1873,7 @@ Defines the network capability set.
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| callback | Callback\<{ iface: string, active: boolean }\> | Yes | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| callback | AsyncCallback\<{ iface: string, active: boolean }\> | Yes | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| callback | Callback\<{ iface: string, active: boolean }> | No | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| callback | AsyncCallback\<{ iface: string, active: boolean }> | No | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| 202 | Non-system applications use system APIs. |
| 202 | Applicable only to system applications. |
| 401 | Parameter error. |
**Example**
**Example**
...
@@ -454,7 +460,7 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous
...
@@ -454,7 +460,7 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous
ethernet.off('interfaceStateChange');
ethernet.off('interfaceStateChange');
```
```
## InterfaceConfiguration
## InterfaceConfiguration<sup>9+</sup>
Defines the network configuration for the Ethernet connection.
Defines the network configuration for the Ethernet connection.
...
@@ -471,7 +477,7 @@ Defines the network configuration for the Ethernet connection.
...
@@ -471,7 +477,7 @@ Defines the network configuration for the Ethernet connection.
| netMask | string | Yes| Subnet mask of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.|
| netMask | string | Yes| Subnet mask of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.|
| dnsServers | string | Yes| DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).|
| dnsServers | string | Yes| DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).|
## IPSetMode
## IPSetMode<sup>9+</sup>
Defines the configuration mode of the Ethernet connection.
Defines the configuration mode of the Ethernet connection.
@@ -811,7 +811,7 @@ Defines the mDNS service information.
...
@@ -811,7 +811,7 @@ Defines the mDNS service information.
| host | [NetAddress](js-apis-net-connection.md#netaddress) | No| IP address of the device that provides the mDNS service. The IP address is not effective when an mDNS service is added or removed. |
| host | [NetAddress](js-apis-net-connection.md#netaddress) | No| IP address of the device that provides the mDNS service. The IP address is not effective when an mDNS service is added or removed. |
Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result.
Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result.
...
@@ -54,7 +54,7 @@ observer.on('networkStateChange', data => {
...
@@ -54,7 +54,7 @@ observer.on('networkStateChange', data => {
## observer.on('networkStateChange')
## observer.on('networkStateChange')
on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback<NetworkState\>\): void;
on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback\<NetworkState\>\): void;
Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
...
@@ -94,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data => {
...
@@ -94,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data => {
Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result.
Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result.
...
@@ -111,6 +111,10 @@ Unregisters the observer for network status change events. This API uses an asyn
...
@@ -111,6 +111,10 @@ Unregisters the observer for network status change events. This API uses an asyn
| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. |
| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. |
| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).|
| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
...
@@ -170,7 +173,7 @@ observer.on('signalInfoChange', data => {
...
@@ -170,7 +173,7 @@ observer.on('signalInfoChange', data => {
## observer.on('signalInfoChange')
## observer.on('signalInfoChange')
on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback<Array<SignalInformation\>\>): void;
on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback\<Array\<SignalInformation\>\>): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
...
@@ -182,7 +185,7 @@ Registers an observer for signal status change events of the SIM card in the spe
...
@@ -182,7 +185,7 @@ Registers an observer for signal status change events of the SIM card in the spe
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
**Error codes**
...
@@ -190,7 +193,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -190,7 +193,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
...
@@ -290,7 +295,7 @@ observer.on('cellInfoChange', data => {
...
@@ -290,7 +295,7 @@ observer.on('cellInfoChange', data => {
## observer.on('cellInfoChange')<sup>8+</sup>
## observer.on('cellInfoChange')<sup>8+</sup>
on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback<CellInformation\>\): void;
on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback\<Array\<CellInformation\>\>\): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
...
@@ -302,17 +307,20 @@ Registers an observer for signal status change events of the SIM card in the spe
...
@@ -302,17 +307,20 @@ Registers an observer for signal status change events of the SIM card in the spe
The **runningLock** module provides APIs for creating, querying, holding, and releasing running locks.
The **runningLock** module provides APIs for creating, querying, holding, and releasing running locks.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
## Modules to Import
...
@@ -15,7 +16,7 @@ import runningLock from '@ohos.runningLock';
...
@@ -15,7 +16,7 @@ import runningLock from '@ohos.runningLock';
isSupported(type: RunningLockType): boolean;
isSupported(type: RunningLockType): boolean;
Checks whether a specified type of **RunningLock** is supported.
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead.
Checks whether a specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses an asynchronous callback to return the result.
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object. |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the query result obtained, where the value **true** indicates that **RunningLock** is supported and **false** indicates the opposite. Otherwise, **err** is an error object.|
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the query result obtained, where the value **true** indicates that the specified type of **RunningLock** is supported and **false** indicates the opposite. Otherwise, **err** is an error object.|
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead.
Checks whether a specified type of **RunningLock** is supported. This API uses a promise to return the result.
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses a promise to return the result.
| boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.|
| boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.|
@@ -16,7 +16,48 @@ import fetch from '@system.fetch';
...
@@ -16,7 +16,48 @@ import fetch from '@system.fetch';
## fetch.fetch<sup>3+</sup>
## fetch.fetch<sup>3+</sup>
fetch(Object): void
fetch(options:{
/**
* Resource URL.
* @since 3
*/
url: string;
/**
* Request parameter, which can be of the string type or a JSON object.
* @since 3
*/
data?: string | object;
/**
* Request header, which accommodates all attributes of the request.
* @since 3
*/
header?: Object;
/**
* Request methods available: OPTIONS, GET, HEAD, POST, PUT, DELETE and TRACE. The default value is GET.
* @since 3
*/
method?: string;
/**
* The return type can be text, or JSON. By default, the return type is determined based on Content-Type in the header returned by the server.
* @since 3
*/
responseType?: string;
/**
* Called when the network data is obtained successfully.
* @since 3
*/
success?: (data: FetchResponse) => void;
/**
* Called when the network data fails to be obtained.
* @since 3
*/
fail?: (data: any, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
} ): void
Obtains data through a network.
Obtains data through a network.
...
@@ -43,7 +84,9 @@ Obtains data through a network.
...
@@ -43,7 +84,9 @@ Obtains data through a network.
| Object | Not set| The default value of **Content-Type** is **application/x-www-form-urlencoded**. The **data** value is encoded based on the URL rule and appended in the request body.|
| Object | Not set| The default value of **Content-Type** is **application/x-www-form-urlencoded**. The **data** value is encoded based on the URL rule and appended in the request body.|
| Object | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.|
| Object | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.|
The **thermal** module provides thermal level-related callback and query APIs to obtain the information required for thermal control.
The **thermal** module provides thermal level-related callback and query APIs to obtain the information required for thermal control.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
## Modules to Import
...
@@ -29,9 +30,9 @@ Subscribes to thermal level changes.
...
@@ -29,9 +30,9 @@ Subscribes to thermal level changes.
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
|---------|---------|
| 4800101 | Operation failed. Cannot connect to service.|
| 4800101 | If connecting to the service failed. |
**Example**
**Example**
...
@@ -58,15 +59,15 @@ Unsubscribes from thermal level changes.
...
@@ -58,15 +59,15 @@ Unsubscribes from thermal level changes.
| callback | Callback<void> | No | Callback used to return the result. No value is returned. If this parameter is not set, this API unsubscribes from all callbacks.|
| callback | Callback<void> | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.|
**Error codes**
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
|---------|---------|
| 4800101 | Operation failed. Cannot connect to service.|
| 4800101 | If connecting to the service failed. |
**Example**
**Example**
...
@@ -93,15 +94,15 @@ Obtains the current thermal level.
...
@@ -93,15 +94,15 @@ Obtains the current thermal level.
| Type | Description |
| Type | Description |
| ------------ | ------------ |
| ------------ | ------------ |
| ThermalLevel | Thermal level obtained.|
| ThermalLevel | Thermal level.|
**Error codes**
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
|---------|---------|
| 4800101 | Operation failed. Cannot connect to service.|
| 4800101 | If connecting to the service failed. |
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9).
> This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9).
> This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9) instead.
Unsubscribes from thermal level changes.
Unsubscribes from thermal level changes.
...
@@ -154,7 +153,7 @@ Unsubscribes from thermal level changes.
...
@@ -154,7 +153,7 @@ Unsubscribes from thermal level changes.
| callback | AsyncCallback<void> | No | Callback used to return the result. No value is returned. If this parameter is not set, this API unsubscribes from all callbacks.|
| callback | AsyncCallback<void> | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.|