The distributed data objects allow data across devices to be processed like local variables by shielding complex data interaction between devices. For the devices that form a Super Device, when data in the distributed data object of an application is added, deleted, or modified on a device, the data for the same application is also updated on the other devices. The devices can listen for the data changes and online and offline states of other devices. The distributed data objects support basic data types, such as number, string, and Boolean, as well as complex data types, such as array and nested basic types.
The distributed data objects allow data across devices to be processed like local variables by shielding complex data interaction between devices. For the devices that form a Super Device, when data in the distributed data object of an application is added, deleted, or modified on a device, the data for the same application is also updated on the other devices. The devices can listen for the data changes and online and offline status of other devices. The distributed data objects support basic data types, such as number, string, and Boolean, as well as complex data types, such as array and nested basic types.
## Available APIs
...
...
@@ -15,7 +15,7 @@ Call **createDistributedObject()** to create a distributed data object instance.
**Table 1** API for creating a distributed data object instance
| Package| API| Description|
| -------- | -------- | -------- |
| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | Creates a distributed data object instance for data operations.<br>- **source**: attributes of the **distributedObject** set.<br>- **DistributedObject**: returns the distributed object created.|
| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | Creates a distributed data object instance for data operations.<br>- **source**: attributes of the **distributedObject** set.<br>- **DistributedObject**: returns the distributed object created.|
### Generating a Session ID
...
...
@@ -28,12 +28,12 @@ Call **genSessionId()** to generate a session ID randomly. The generated session
### Setting a SessionID for Distributed Data Objects
Call setSessionId() to set the session ID for a distributed data object. The session ID is a unique identifier for one collaboration across devices. The distributed data objects to be synchronized must be associated with the same session ID.
Call **setSessionId()** to set a session ID for a distributed data object. The session ID is a unique identifier for one collaboration across devices. The distributed data objects to be synchronized must be associated with the same session ID.
**Table 3** API for setting a session ID
| Class| API| Description|
| -------- | -------- | -------- |
| DistributedDataObject | setSessionId(sessionId?: string): boolean | Sets a session ID for distributed data objects.<br> **sessionId**: ID of a distributed object in a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.|
| DistributedDataObject | setSessionId(sessionId?: string): boolean | Sets a session ID for distributed data objects.<br> **sessionId**: session ID of a distributed object in a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.|
### Observing Data Changes
...
...
@@ -43,7 +43,7 @@ Call **on()** to subscribe to data changes of a distributed data object. When th
| Class| API| Description|
| -------- | -------- | -------- |
| DistributedDataObject| on(type: 'change', callback: Callback<{sessionId:string,fields:Array<string>}>): void | Subscribes to data changes.|
| DistributedDataObject| off(type: 'change', callback?: Callback<{sessionId:string,fields:Array<string>}>): void | Unsubscribes from data changes. Callback used to return changes of the distributed object. If this parameter is not specified, all callbacks related to data changes will be unregistered.|
| DistributedDataObject| off(type: 'change', callback?: Callback<{sessionId:string,fields:Array<string>}>): void | Unsubscribes from data changes. <br>**Callback**: specifies callback used to return changes of the distributed data object. If this parameter is not specified, all callbacks related to data changes will be unregistered.|
### Observing Online or Offline Status
...
...
@@ -90,10 +90,10 @@ The following example shows how to implement a distributed data object synchroni
// After obtaining that the device status goes online, the remote object synchronizes data. That is, name changes to jack and age to 18.
// After learning that the device goes online, the remote object synchronizes data. That is, name changes to jack and age to 18.
```
4. Observe the data changes of the distributed data object. Subscribe to data changes of the remote end. When the data is the peer end changes, a callback will be called to return the data changes.
4. Observe the data changes of the distributed data object. You can subscribe to data changes of the remote object. When the data in the remote object changes, a callback will be called to return the data changes.
The sample code is as follows:
...
...
@@ -108,8 +108,8 @@ The following example shows how to implement a distributed data object synchroni
}
}
// To refresh the page in changeCallback, correctly set this.changeCallback.bind(this) in
changeCallback.
// To refresh the page in changeCallback, correctly bind (this) to the changeCallback.
5. Modify object attributes. The object attributes support basic data types (such as number, Boolean, and string) and complex data types (array and nested basic types).
...
...
@@ -123,7 +123,7 @@ The following example shows how to implement a distributed data object synchroni
> For the distributed data object of the complex type, only the root attribute can be modified. The subordinate attributes cannot be modified. Example:
```js
// Supported modification.
...
...
@@ -142,7 +142,7 @@ The following example shows how to implement a distributed data object synchroni
The sample code is as follows:
```js
// Unsubscribe from changeCallback.
// Unsubscribe from the specified data change callback.
local_object.off("change",changeCallback);
// Unsubscribe from all data change callbacks.
local_object.off("change");
...
...
@@ -156,16 +156,16 @@ The following example shows how to implement a distributed data object synchroni
local_object.on("status",this.statusCallback);
```
9. Unsubscribe from the status changes of the distributed data object. You can specify the callback to unsubscribe from. If you do not specify the callback, all status change callbacks will be unsubscribe from.
9. Unsubscribe from the status changes of the distributed data object. You can specify the callback to unsubscribe from. If you do not specify the callback, this API unsubscribes from all callbacks of this distributed data object.
The sample code is as follows:
```js
// Unsubscribe from the online status change callback.
// Unsubscribe from the specified status change callback.
local_object.off("status",statusCallback);
// Unsubscribe from all online status change callbacks.
// Unsubscribe from all status change callbacks.
local_object.off("status");
```
10. Remove a distributed data object from the synchronization network. After the distributed data object is removed from the network, the data changes on the local end will not be synchronized to the remote end.
10. Remove a distributed data object from the synchronization network. Data changes on the local object will not be synchronized to the removed distributed data object.
The sample code is as follows:
```js
...
...
@@ -173,10 +173,10 @@ The following example shows how to implement a distributed data object synchroni
```
## Development Example
The following example is provided for you to better understand the development of distributed data object:
The following example is provided for you to better understand the development of distributed data objects:
When an event occurs on a device, such as a note is added, the tile or content of a note is changed, and the event list is cleared, the change will be synchronized to other devices in the trusted network by the Notepad app.
When an event of the Notepad app occurs on a device, such as a note is added, the tile or content of a note is changed, or the event list is cleared, the change will be synchronized to other devices in the trusted network.
> 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.
...
...
@@ -26,7 +26,7 @@ Creates a distributed data object.
| -------- | -------- | -------- | -------- |
| source | object | Yes| Attribute of the distributed data object to create.|
**Return Value**
**Return value**
| Type| Description|
| -------- | -------- |
| [DistributedObject](#distributedobject) | Distributed data object created.|
...
...
@@ -34,7 +34,7 @@ Creates a distributed data object.
@@ -78,7 +78,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo
| -------- | -------- | -------- | -------- |
| sessionId | string | No| ID of a distributed data object on a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.|
**Return Value**
**Return value**
| Type| Description|
| -------- | -------- |
...
...
@@ -101,15 +101,15 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo
| type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data change events.|
| callback | Callback<{sessionId:string,fields:Array<string>}> | Yes| Callback used to return the changes of the distributed data object.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the attributes of the distributed data object changed.|
| type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data changes.|
| callback | Callback<{sessionId:string,fields:Array<string>}> | Yes| Callback used to return the changes of the distributed data object.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the changed attributes of the distributed data object.|
**Example**
```js
...
...
@@ -130,15 +130,15 @@ Subscribes to the data changes of this distributed data object.
| type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data change events.|
| callback | Callback<{sessionId:string,fields:Array<string>}> | No| Callback used to return changes of the distributed data object. If this parameter is not specified, all callbacks related to data changes will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the attributes of the distributed data object changed.|
| type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes.|
| callback | Callback<{sessionId:string,fields:Array<string>}> | No| Callback used to return the changes of the distributed data object. If this parameter is not specified, this API unsubscribes from all callbacks for data changes of this distributed data object.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the changed attributes of the distributed data object.|
**Example**
...
...
@@ -149,11 +149,11 @@ Unsubscribes from the data changes of this distributed data object.
| type | string | Yes| Event type to subscribe to. The value is "status", which indicates the status (online or offline) change events.|
| callback | Callback<{sessionId:string,networkId:string,status:'online'\|'offline'}> | Yes| Callback used to return the online or offline status.<br>**sessionId** indicates the session ID of the distributed data object.<br>**networkId** indicates the network ID of the device.<br>**status** indicates the status, which can be online or offline.|
| type | string | Yes| Event type to subscribe to. The value is **status**, which indicates the change in the status (online or offline) of the distributed data object.|
| callback | Callback<{sessionId:string,networkId:string,status:'online'\|'offline'}> | Yes| Callback used to return the status change.<br>**sessionId** indicates the session ID of the distributed data object.<br>**networkId** indicates the network ID of the device.<br>**status** indicates the status, which can be online or offline.|
**Example**
```js
...
...
@@ -186,15 +186,15 @@ Subscribes to the status changes (online or offline) of this distributed data ob
| type | string | Yes| Event type to subscribe to. The value is "status", which indicates the status (online or offline) change events.|
| callback | Callback<{sessionId:string,deviceId:string,status:'online'\|'offline'}> | No| Callback used to return the status changes. If this parameter is not specified, all the status change callbacks will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**deviceId** indicates the device ID of the distributed data object.<br>**status** indicates the status, which can be online or offline.|
| type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the change in the status (online or offline) of the distributed data object.|
| callback | Callback<{sessionId:string,deviceId:string,status:'online'\|'offline'}> | No| Callback used to return the status change. If this parameter is not specified, this API unsubscribes from all callbacks of this distributed data object.<br>**sessionId** indicates the session ID of the distributed data object.<br>**deviceId** indicates the device ID of the distributed data object.<br>**status** indicates the status, which can be online or offline.|
**Example**
...
...
@@ -203,10 +203,10 @@ Unsubscribes from the status (online or offline) changes of the distributed data
Preferences provide capabilities for processing key-value (KV) data for applications and supports lightweight data persistence, modification, and query. Data is stored in KV pairs. Keys are of the string type, and values can be of the number, string, or Boolean type.
Preferences provide capabilities for processing data in the form of key-value (KV) pairs and supports lightweight data persistence, modification, and query. In KV pairs, keys are of the string type, and values can be of the number, string, or Boolean type.
Reads a preference persistence file and loads data to the **Preferences** instance for data operations. This API uses an asynchronous callback to return the result.
Reads a **Preferences** persistence file and loads data to the **Preferences** instance for data operations. This API uses an asynchronous callback to return the result.
Reads a preference persistence file and loads data to the **Preferences** instance for data operations. This API uses a promise to return the result.
Reads a **Preferences** persistence file and loads data to the **Preferences** instance for data operations. This API uses a promise to return the result.
Deletes a **Preferences** singleton instance, the persistence file and backup file, and corrupted files from the memory.
Once a preference persistence file is deleted, the **Preferences** instance cannot be used for data operations. Otherwise, data inconsistency will occur. This API uses an asynchronous callback to return the execution result.
Once a **Preferences** persistence file is deleted, the **Preferences** instance cannot be used for data operations. Otherwise, data inconsistency will occur. This API uses an asynchronous callback to return the result.
Deletes a **Preferences** singleton instance, the persistence file and backup file, and corrupted files from the memory.
Once a preference persistence file is deleted, the **Preferences** instance cannot be used for data operations. Otherwise, data inconsistency will occur. This API uses a promise to return the execution result.
Once a **Preferences** persistence file is deleted, the **Preferences** instance cannot be used for data operations. Otherwise, data inconsistency will occur. This API uses a promise to return the result.
Removes a **Preferences** singleton instance from the memory.
When a **Preferences** singleton instance is removed, this instance cannot be used for data operations. Otherwise, data inconsistency will occur. This API uses an asynchronous callback to return the execution result.
When a **Preferences** singleton instance is removed, this instance cannot be used for data operations. Otherwise, data inconsistency will occur. This API uses an asynchronous callback to return the result.
Obtains a **Preferences** instance, writes data to the **Preferences** instance, and saves the data to the file using **flush()** or **flushSync()**. This API uses an asynchronous callback to return the execution result.
Puts a new value to this **Preferences** instance and its persistence file. This API uses an asynchronous callback to return the result.
Obtains a **Preferences** instance, writes data to the **Preferences** instance, and saves the data to the file using **flush()** or **flushSync()**. This API uses a promise to return the execution result.
Puts a new value to this **Preferences** instance and its persistence file. This API uses a promise to return the result.
@@ -560,7 +560,7 @@ Deletes the KV pair of the specified key from this **Preferences** instance. Thi
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<void> | Promise used to return the execution result.|
| Promise<void> | Promise used to return the result.|
**Example**
```ts
...
...
@@ -587,14 +587,14 @@ Deletes the KV pair of the specified key from this **Preferences** instance. Thi
flush(callback: AsyncCallback<void>): void
Saves the modification to this **Preferences** instance and synchronizes the modification to the preference persistence file. This API uses an asynchronous callback to return the result.
Saves the modification to this **Preferences** instance and synchronizes the modification to the **Preferences** persistence file. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes| Callback used to return the execution result.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Example**
```ts
...
...
@@ -623,14 +623,14 @@ Saves the modification to this **Preferences** instance and synchronizes the mod
flush(): Promise<void>
Saves the modification to this **Preferences** instance and synchronizes the modification to the preference persistence file. This API uses a promise to return the result.
Saves the modification to this **Preferences** instance and synchronizes the modification to the **Preferences** persistence file. This API uses a promise to return the result.
Openharmony Universal KeyStore (HUKS) provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations. HUKS also provides APIs for applications to import or generate keys.
OpenHarmony Universal KeyStore (HUKS) provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations. HUKS also provides APIs for applications to import or generate keys.
| function generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void; | Generates a private key. This method uses an asynchronous callback to return the result. |
| function generateKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>; | Generates a private key. This method uses a promise to return the result. |
| function generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void; | Generates a key. This method uses an asynchronous callback to return the result. |
| function generateKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>; | Generates a key. This method uses a promise to return the result. |
| function exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void; | Exports the public key. This method uses an asynchronous callback to return the result. |
| function exportKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>; | Exports the public key. This method uses a promise to return the result. |
| function isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback<boolean>) : void; | Check whether a key exists. This method uses an asynchronous callback to return the result.|
| function isKeyExist(keyAlias: string, options: HuksOptions) : Promise<boolean>; | Check whether a key exists. This method uses a promise to return the result.|
| function isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback<boolean>) : void; | Checks whether a key exists. This method uses an asynchronous callback to return the result. |
| function isKeyExist(keyAlias: string, options: HuksOptions) : Promise<boolean>; | Checks whether a key exists. This method uses a promise to return the result. |
| function deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void; | Deletes a key. This method uses an asynchronous callback to return the result. |
| function deleteKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>; | Deletes a key. This method uses a promise to return the result. |
...
...
@@ -26,7 +26,7 @@
importhuksfrom'@ohos.security.huks'
```
2. Call **generateKey()** to generate a private key.
2. Call **generateKey()** to generate a key.
**keyAlias** indicates the alias of the key generated. **options** indicates the parameters used for generating the key. Set **options** based on the actual situation.
...
...
@@ -59,7 +59,7 @@
3. Call **Init()** to initialize the key.
**Alias** indicates the alias of the key to initialize, and **options** indicates the parameters used for initializing the key.
**Alias** indicates the alias of the key to initialize, and **options** indicates the parameters used for initializing the key. Set **options** based on the actual situation.
The value returned indicates whether the **Init** operation is successful.
...
...
@@ -92,7 +92,7 @@
4. Call **update()** to update the key.
**handle** indicates the session ID for updating the key. **options** indicates the parameters used for updating the key.
**handle** indicates the session ID for updating the key. **options** indicates the parameters used for updating the key. Set **options** based on the actual situation.
The value returned indicates whether the **Update** operation is successful.
...
...
@@ -118,7 +118,7 @@
5. Call **finish()** to complete the operation.
**handle** indicates the session ID of the **Finish** operation. **options** indicates the parameters used for this operation.
**handle** indicates the session ID of the **Finish** operation. **options** indicates the parameters used for this operation. Set **options** based on the actual situation.
The value returned indicates whether the **Finish** operation is successful.
Driver services are objects of capabilities provided by HDF driver devices to external systems and are managed by the HDF in a unified manner. Driver service management involves providing and obtaining driver services.
Driver services are objects of capabilities provided by HDF driver devices to external systems and are managed by the HDF in a unified manner. Driver service management involves publishing and obtaining driver services.
The HDF uses the **policy** field in the configuration file to define policies for drivers to provide services externally. The values this field are as follows:
The HDF uses the **policy** field in the configuration file to define policies for drivers to publish services externally. The values this field are as follows:
...
...
@@ -12,13 +12,13 @@ The HDF uses the **policy** field in the configuration file to define policies f
typedef enum {
/* The driver does not provide services. */
SERVICE_POLICY_NONE = 0,
/* The driver provides services only for kernel-mode applications. */
/* The driver publishes services only for kernel-mode processes. */
SERVICE_POLICY_PUBLIC = 1,
/* The driver provides services for both kernel- and user-mode applications. */
/* The driver publishes services for both kernel- and user-mode processes. */
SERVICE_POLICY_CAPACITY = 2,
/** The driver services are not provided externally but can be subscribed to. */
/** The driver services are not published externally but can be subscribed to. */
SERVICE_POLICY_FRIENDLY = 3,
/* The driver private services cannot be provided externally or subscribed to. */
/* The driver private services cannot be published externally or subscribed to. */
@@ -11,7 +11,7 @@ Enhanced Swap (ESwap) allows a custom partition to serve as a swap partition and
### Enabling ESwap
1. Enable related configuration items and dependencies.
To enable ESwap, you need to enable the corresponding configuration items and dependencies during kernel compilation. The configuration items related to ESwap are as follows:
To enable ESwap, you must enable the corresponding configuration items and dependencies during kernel compilation. The configuration items related to ESwap are as follows:
```
CONFIG_HYPERHOLD=y
...
...
@@ -41,13 +41,13 @@ Enhanced Swap (ESwap) allows a custom partition to serve as a swap partition and
```Bash
// Run the dd command to create the hpdisk file for ESwap. In this example, the file size is 512 MB. Set the file size based on service requirements.
@@ -56,11 +56,11 @@ Enhanced Swap (ESwap) allows a custom partition to serve as a swap partition and
By default, ESwap encrypts the data swapped out. If the ESwap device created in step 2 supports inline encryption, you can disable the ESwap software encryption function.
```Bash
// Check whether hardware-based encryption is supported and enabled. If not, do not perform this operation.
// Check whether hardware-based encryption is supported and enabled. If yes, disable software encryption. Otherwise, do not perform this operation.
> For security purposes, all swapped content must be encrypted. If the ESwap device created does not support inline encryption or the inline encryption macro is not enabled during compilation, ESwap cannot be enabled after software encryption is disabled.
4. Enable ESwap.
...
...
@@ -72,8 +72,8 @@ Enhanced Swap (ESwap) allows a custom partition to serve as a swap partition and
> Enable ESwap before zram is enabled. If ESwap is not used, you can enable zram only. If a device does not have the storage device for swap-out or have the corresponding storage partition created, you can enable ZRAM to reclaim memory using **zswapd**.
> Enable ESwap before zram is enabled. If ESwap is not used, you can enable zram only. If a device does not have the storage device for swap-out or have the corresponding storage partition created, you can enable zram to reclaim memory using **zswapd**.
### Enabling zram
...
...
@@ -88,7 +88,7 @@ Enhanced Swap (ESwap) allows a custom partition to serve as a swap partition and
> The difference of the two commands is as follows:
>
> - **disable**: If there is no data in the ESwap partition, disable ESwap. Otherwise, changes ESwap to read-only mode.
> - **force_disable**: If there is no data in the ESwap partition, disable ESwap. Otherwise, changes ESwap to read-only mode and disable ESwap until all data in the ESWAP partition is read.
> - **disable**: If there is no data in the ESwap partition, disable ESwap. Otherwise, changes ESwap to **readonly** mode.
> - **force_disable**: If there is no data in the ESwap partition, disable ESwap. Otherwise, changes ESwap to **readonly** mode and disable ESwap until all data in the ESWAP partition is read.
2. Disable zram and zram group.
...
...
@@ -143,7 +143,7 @@ ESwap provides APIs to control swap-in and swap-out policies and record the curr
| | [stat](#stat) | Checks the real-time status of ESwap.|
| | [zswapd_vmstat_show](#zswapd_vmstat_show) | Records events during the zswapd running.|
> Only **avail_buffers** proactively wakes up zswapd because the buffer waterline is adjusted. Other control APIs do not proactively wake up zswapd, but their configuration takes effect only after zswapd is woken up.
As a mandatory component for device networking, the network management subsystem manages different types of network connections in a unified manner and provides network protocol stack capabilities. An application can call APIs to obtain connection information of a data network, query and subscribe to connection status, and transfer data by using the network protocol stack.
...
...
@@ -14,7 +14,7 @@ The network management subsystem consists of the following components:
### Receiving Network Status Change Notifications<a name="section1458213210369"></a>
### Receiving Network Status Change Notifications
1. Import the **connection** namespace from **@ohos.net.connection.d.ts**.
2. Call **createNetConnection()** to create a **NetConnection object**. You can specify the network capability, network type, and timeout interval (optional).
2. Call **createNetConnection()** to create a **NetConnection** object. You can specify the network capability, network type, and timeout interval.
3. Call the **on()** method of the object to subscribe to concerned events by specifying **type** and **callback**.
4. Call the **register()** method of the object to subscribe to status change notifications of the specified network.
4. Call the **register()** method of the object to subscribe to status changes of the specified network.
5. When the network is available, the callback will be invoked to return the **netAvailable** event.
6. Call the **unregister()** method of the object to unsubscribe from the notifications if required.
6. Call the **unregister()** method of the object to unsubscribe from the status changes if required.
```
// Import the package name.
...
...
@@ -66,11 +66,11 @@ foundation/communication/
```
### Sending a Network Request<a name="section750135512369"></a>
### Sending a Network Request
1. Import the **http** namespace from **@ohos.net.http.d.ts**.
2. Call the **createHttp** method to create an **HttpRequest** object.
3. Call the **on()** method of the object to subscribe to the HTTP response header. This method returns a response earlier than the request. You can subscribe to HTTP Response Header events based on service requirements.
3. Call the **on()** method of the object to subscribe to the HTTP response header. This method returns a response earlier than the request. You can subscribe to HTTP response header events based on service requirements.
4. Call the **request()** method of the object with the URL and optional parameters of the HTTP request to initiate a network request.
5. Parse the returned result based on service requirements.
6. Call the **destroy()** method to destroy the request.
...
...
@@ -81,7 +81,7 @@ import http from '@ohos.net.http';
// Each httpRequest corresponds to an HttpRequestTask object and cannot be reused.
let httpRequest = http.createHttp();
// Subscribe to the HTTP response header, which is returned earlier than httpRequest. You can subscribe to HTTP Response Header events based on service requirements.
// Subscribe to the HTTP response header, which is returned earlier than httpRequest. You can subscribe to HTTP response header events based on service requirements.