提交 309ede8d 编写于 作者: H HelloCrease

Merge branch 'OpenHarmony-3.2-Release' of https://gitee.com/HelloCrease/docs...

Merge branch 'OpenHarmony-3.2-Release' of https://gitee.com/HelloCrease/docs into OpenHarmony-3.2-Release
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- About OpenHarmony - About OpenHarmony
- [OpenHarmony Project](../OpenHarmony-Overview.md) - [OpenHarmony Project](../OpenHarmony-Overview.md)
- [Glossary](../glossary.md) - [Glossary](../glossary.md)
- [OpenHarmony Release Notes](../release-notes/Readme.md) - [Release Notes](../release-notes/Readme.md)
- Quick Start - Quick Start
- Getting Started - Getting Started
- [Before You Start](quick-start/start-overview.md) - [Before You Start](quick-start/start-overview.md)
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
- Application Package Fundamentals - Application Package Fundamentals
- [Application Package Overview](quick-start/application-package-overview.md) - [Application Package Overview](quick-start/application-package-overview.md)
- Application Package Structure - Application Package Structure
- [Application Package Structure in Stage Model)](quick-start/application-package-structure-stage.md) - [Application Package Structure in Stage Model](quick-start/application-package-structure-stage.md)
- [Application Package Structure in FA Model](quick-start/application-package-structure-fa.md) - [Application Package Structure in FA Model](quick-start/application-package-structure-fa.md)
- Multi-HAP Mechanism - Multi-HAP Mechanism
- [Multi-HAP Design Objectives](quick-start/multi-hap-objective.md) - [Multi-HAP Design Objectives](quick-start/multi-hap-objective.md)
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
- Application Configuration Files in FA Model - Application Configuration Files in FA Model
- [Application Configuration File Overview (FA Model)](quick-start/application-configuration-file-overview-fa.md) - [Application Configuration File Overview (FA Model)](quick-start/application-configuration-file-overview-fa.md)
- [Internal Structure of the app Tag](quick-start/app-structure.md) - [Internal Structure of the app Tag](quick-start/app-structure.md)
- [Internal structure of deviceConfig Tag](quick-start/deviceconfig-structure.md) - [Internal Structure of the deviceConfig Tag](quick-start/deviceconfig-structure.md)
- [Internal Structure of the module Tag](quick-start/module-structure.md) - [Internal Structure of the module Tag](quick-start/module-structure.md)
- [Resource Categories and Access](quick-start/resource-categories-and-access.md) - [Resource Categories and Access](quick-start/resource-categories-and-access.md)
- Learning ArkTS - Learning ArkTS
...@@ -47,19 +47,19 @@ ...@@ -47,19 +47,19 @@
- Custom Component - Custom Component
- [Creating a Custom Component](quick-start/arkts-create-custom-components.md) - [Creating a Custom Component](quick-start/arkts-create-custom-components.md)
- [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md) - [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md)
- [\@Builder: Custom Builder Function](quick-start/arkts-builder.md) - [\@Builder Decorator: Custom Builder Function](quick-start/arkts-builder.md)
- [\@BuilderParam: @Builder Function Reference](quick-start/arkts-builderparam.md) - [\@BuilderParam Decorator: \@Builder Function Reference](quick-start/arkts-builderparam.md)
- [\@Styles: Definition of Resusable Styles](quick-start/arkts-style.md) - [\@Styles Decorator: Definition of Resusable Styles](quick-start/arkts-style.md)
- [\@Extend: Extension of Built-in Components](quick-start/arkts-extend.md) - [\@Extend Decorator: Extension of Built-in Components](quick-start/arkts-extend.md)
- [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md) - [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md)
- State Management - State Management
- [State Management Overview](quick-start/arkts-state-management-overview.md) - [State Management Overview](quick-start/arkts-state-management-overview.md)
- Component State Management - Component State Management
- [\@State: State Owned by Component](quick-start/arkts-state.md) - [\@State Decorator: State Owned by Component](quick-start/arkts-state.md)
- [\@Prop: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md) - [\@Prop Decorator: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md)
- [\@Link: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md) - [\@Link Decorator: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md)
- [\@Provide and \@Consume: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.md) - [\@Provide and \@Consume Decorators: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.md)
- [\@Observed and \@ObjectLink: Observing Attribute Changes in Nested Class Objects](quick-start/arkts-observed-and-objectlink.md) - [\@Observed and \@ObjectLink Decorators: Observing Attribute Changes in Nested Class Objects](quick-start/arkts-observed-and-objectlink.md)
- Application State Management - Application State Management
- [Application State Management Overview](quick-start/arkts-application-state-management-overview.md) - [Application State Management Overview](quick-start/arkts-application-state-management-overview.md)
- [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md) - [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md)
...@@ -68,10 +68,10 @@ ...@@ -68,10 +68,10 @@
- [Environment: Device Environment Query](quick-start/arkts-environment.md) - [Environment: Device Environment Query](quick-start/arkts-environment.md)
- Other State Management Features - Other State Management Features
- [Overview of Other State Management Features](quick-start/arkts-other-state-mgmt-functions-overview.md) - [Overview of Other State Management Features](quick-start/arkts-other-state-mgmt-functions-overview.md)
- [\@Watch: Getting Notified of State Variable Changes](quick-start/arkts-watch.md) - [\@Watch Decorator: Getting Notified of State Variable Changes](quick-start/arkts-watch.md)
- [$$ Syntax: Two-Way Synchronization of Built-in Components](quick-start/arkts-two-way-sync.md) - [$$ Syntax: Two-Way Synchronization of Built-in Components](quick-start/arkts-two-way-sync.md)
- Rendering Control - Rendering Control
- [Rendering Control Overview](quick-start/arkts-rendering-control-overview.md) - [Overview of Rendering Control](quick-start/arkts-rendering-control-overview.md)
- [if/else: Conditional Rendering](quick-start/arkts-rendering-control-ifelse.md) - [if/else: Conditional Rendering](quick-start/arkts-rendering-control-ifelse.md)
- [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md) - [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md)
- [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md) - [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md)
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
- [DFX](dfx/Readme-EN.md) - [DFX](dfx/Readme-EN.md)
- [Internationalization](internationalization/Readme-EN.md) - [Internationalization](internationalization/Readme-EN.md)
- [Application Test](application-test/Readme-EN.md) - [Application Test](application-test/Readme-EN.md)
- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md) - [IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Native APIs](napi/Readme-EN.md) - [Native APIs](napi/Readme-EN.md)
- Tools - Tools
- [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md) - [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md)
...@@ -109,11 +109,11 @@ ...@@ -109,11 +109,11 @@
- [SystemCapability List](reference/syscap-list.md) - [SystemCapability List](reference/syscap-list.md)
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md) - [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md)
- [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md) - [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md)
- [JS Service Widget UI Components](reference/js-service-widget-ui/Readme-EN.md) - [JavaScript Service Widget UI Component Reference](reference/js-service-widget-ui/Readme-EN.md)
- APIs - API Reference
- [ArkTS and JS APIs](reference/apis/Readme-EN.md) - [ArkTS and JavaScript APIs](reference/apis/Readme-EN.md)
- [Error Codes](reference/errorcodes/Readme-EN.md) - [Error Codes](reference/errorcodes/Readme-EN.md)
- Native APIs - Native API Reference
- [Native APIs](reference/native-apis/Readme-EN.md) - [Native APIs](reference/native-apis/Readme-EN.md)
- [Standard Libraries](reference/native-lib/third_party_libc/musl.md) - [Standard Libraries](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md) - [Node_API](reference/native-lib/third_party_napi/napi.md)
......
...@@ -10,7 +10,7 @@ The documents are carefully organized as follows: ...@@ -10,7 +10,7 @@ The documents are carefully organized as follows:
## Getting Started ## Getting Started
[Here](quick-start/start-overview.md) you'll learn how to quickly get started with OpenHarmony application development. [Here](quick-start/start-overview.md) you can learn how to better prepare yourself for application development.
Browse the documents on the instructions for quickly building your first application and the basics about OpenHarmony applications. Browse the documents on the instructions for quickly building your first application and the basics about OpenHarmony applications.
...@@ -40,12 +40,12 @@ Then, equip yourself for developing the key features, with the following guideli ...@@ -40,12 +40,12 @@ Then, equip yourself for developing the key features, with the following guideli
- [Data Management](database/data-mgmt-overview.md) - [Data Management](database/data-mgmt-overview.md)
- [File Management](file-management/file-management-overview.md) - [File Management](file-management/file-management-overview.md)
- [Task Management](task-management/background-task-overview.md) - [Task Management](task-management/background-task-overview.md)
- [Device](device/usb-overview.md) - [Device Management](device/usb-overview.md)
- [Device Usage Statistics](device-usage-statistics/device-usage-statistics-overview.md) - [Device Usage Statistics](device-usage-statistics/device-usage-statistics-overview.md)
- [DFX](dfx/hiappevent-guidelines.md) - [DFX](dfx/hiappevent-guidelines.md)
- [Internationalization](internationalization/international-overview.md) - [Internationalization](internationalization/international-overview.md)
- [Application Test](application-test/arkxtest-guidelines.md) - [Application Test](application-test/arkxtest-guidelines.md)
- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md) - [IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Using Native APIs in Application Projects](napi/napi-guidelines.md) - [Using Native APIs in Application Projects](napi/napi-guidelines.md)
## Tools ## Tools
...@@ -63,11 +63,12 @@ API references encompass all components and APIs available in OpenHarmony, helpi ...@@ -63,11 +63,12 @@ API references encompass all components and APIs available in OpenHarmony, helpi
They are organized as follows: They are organized as follows:
- [ArkTS API Reference](reference/apis/development-intro.md)
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/ts-components-summary.md) - [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/ts-components-summary.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm- ArkUI.Full)](reference/arkui-js/Readme-EN.md) - [Component Reference (JavaScript-compatible Web-like Development Paradigm- ArkUI.Full)](reference/arkui-js/Readme-EN.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm- ArkUI.Lite)](reference/arkui-js-lite/Readme-EN.md) - [Component Reference (JavaScript-compatible Web-like Development Paradigm- ArkUI.Lite)](reference/arkui-js-lite/Readme-EN.md)
- [JS Service Widget UI Components](reference/js-service-widget-ui/js-service-widget-file.md) - [JavaScript Service Widget UI Component Reference](reference/js-service-widget-ui/js-service-widget-file.md)
- [JS and TS APIs](reference/apis/development-intro.md) - Native API Reference
- Native APIs - [Native APIs](reference/native-apis/_o_h___native_x_component.md)
- [Standard Library](reference/native-lib/third_party_libc/musl.md) - [Standard Libraries](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md) - [Node_API](reference/native-lib/third_party_napi/napi.md)
# Applying Custom Drawing in the Widget # Applying Custom Drawing in the Widget
You can apply custom drawing in your ArkTS widget to create a more vibrant experience. Use the [Canvas](../reference/arkui-ts/ts-components-canvas-canvas.md) component to create a canvas on the widget, and then use the [CanvasRenderingContext2D](../reference/arkui-ts/ts-canvasrenderingcontext2d.md) object to draw custom graphics on the canvas. The following code snippet draws a smiling face in the center of a canvas. You can apply custom drawing in your ArkTS widget to create a more vibrant experience. Use the [\<Canvas>](../reference/arkui-ts/ts-components-canvas-canvas.md) component to create a canvas on the widget, and then use the [CanvasRenderingContext2D](../reference/arkui-ts/ts-canvasrenderingcontext2d.md) object to draw custom graphics on the canvas. The following code snippet draws a smiling face in the center of a canvas.
```ts ```ts
@Entry @Entry
@Component @Component
struct Card { struct WidgetCard {
private canvasWidth: number = 0; private canvasWidth: number = 0;
private canvasHeight: number = 0; private canvasHeight: number = 0;
// Initialize CanvasRenderingContext2D and RenderingContextSettings. // Initialize CanvasRenderingContext2D and RenderingContextSettings.
...@@ -26,9 +26,9 @@ struct Card { ...@@ -26,9 +26,9 @@ struct Card {
this.canvasWidth = this.context.width; this.canvasWidth = this.context.width;
this.canvasHeight = this.context.height; this.canvasHeight = this.context.height;
// Draw the background of the canvas. // Draw the background of the canvas.
this.context.fillStyle = 'rgba(203, 154, 126, 1.00)'; this.context.fillStyle = '#EEF0FF';
this.context.fillRect(0, 0, this.canvasWidth, this.canvasHeight); this.context.fillRect(0, 0, this.canvasWidth, this.canvasHeight);
// Draw a red circle in the center of the canvas. // Draw a circle in the center of the canvas.
this.context.beginPath(); this.context.beginPath();
let radius = this.context.width / 3; let radius = this.context.width / 3;
let circleX = this.context.width / 2; let circleX = this.context.width / 2;
...@@ -36,35 +36,48 @@ struct Card { ...@@ -36,35 +36,48 @@ struct Card {
this.context.moveTo(circleX - radius, circleY); this.context.moveTo(circleX - radius, circleY);
this.context.arc(circleX, circleY, radius, 2 * Math.PI, 0, true); this.context.arc(circleX, circleY, radius, 2 * Math.PI, 0, true);
this.context.closePath(); this.context.closePath();
this.context.fillStyle = 'red'; this.context.fillStyle = '#5A5FFF';
this.context.fill(); this.context.fill();
// Draw the left eye of the smiling face. // Draw the left eye of the smiling face.
let leftR = radius / 4; let leftR = radius / 13;
let leftX = circleX - (radius / 2); let leftX = circleX - (radius / 2.3);
let leftY = circleY - (radius / 3.5); let leftY = circleY - (radius / 4.5);
this.context.beginPath(); this.context.beginPath();
this.context.arc(leftX, leftY, leftR, 0, Math.PI, true); this.context.arc(leftX, leftY, leftR, 0, 2 * Math.PI, true);
this.context.strokeStyle = '#ffff00'; this.context.strokeStyle = '#FFFFFF';
this.context.lineWidth = 10; this.context.lineWidth = 15;
this.context.stroke(); this.context.stroke();
// Draw the right eye of the smiling face. // Draw the right eye of the smiling face.
let rightR = radius / 4; let rightR = radius / 13;
let rightX = circleX + (radius / 2); let rightX = circleX + (radius / 2.3);
let rightY = circleY - (radius / 3.5); let rightY = circleY - (radius / 4.5);
this.context.beginPath(); this.context.beginPath();
this.context.arc(rightX, rightY, rightR, 0, Math.PI, true); this.context.arc(rightX, rightY, rightR, 0, 2 * Math.PI, true);
this.context.strokeStyle = '#ffff00'; this.context.strokeStyle = '#FFFFFF';
this.context.lineWidth = 10; this.context.lineWidth = 15;
this.context.stroke();
// Draw the nose of the smiling face.
let startX = circleX;
let startY = circleY - 20;
this.context.beginPath();
this.context.moveTo(startX, startY);
this.context.lineTo(startX - 8, startY + 40);
this.context.lineTo(startX + 8, startY + 40);
this.context.strokeStyle = '#FFFFFF';
this.context.lineWidth = 15;
this.context.lineCap = 'round'
this.context.lineJoin = 'round'
this.context.stroke(); this.context.stroke();
// Draw the mouth of the smiling face. // Draw the mouth of the smiling face.
let mouthR = radius / 2.5; let mouthR = radius / 2;
let mouthX = circleX; let mouthX = circleX;
let mouthY = circleY + (radius / 3); let mouthY = circleY + 10;
this.context.beginPath(); this.context.beginPath();
this.context.arc(mouthX, mouthY, mouthR, Math.PI, 0, true); this.context.arc(mouthX, mouthY, mouthR, Math.PI / 1.4, Math.PI / 3.4, true);
this.context.strokeStyle = '#ffff00'; this.context.strokeStyle = '#FFFFFF';
this.context.lineWidth = 10; this.context.lineWidth = 15;
this.context.stroke(); this.context.stroke();
this.context.closePath();
}) })
} }
}.height('100%').width('100%') }.height('100%').width('100%')
...@@ -74,4 +87,4 @@ struct Card { ...@@ -74,4 +87,4 @@ struct Card {
The figure below shows the effect. The figure below shows the effect.
![WidgetCanvasDemo](figures/WidgetCanvasDemo.png) ![WidgetCanvasDemo](figures/WidgetCanvasDemo.jpeg)
\ No newline at end of file \ No newline at end of file
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
## When to Use ## When to Use
A static subscriber is started once it receives a target event published by the system or application. At the same time, the [onReceiveEvent()](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md#staticsubscriberextensionabilityonreceiveevent) callback is triggered. A static subscriber is started once it receives a target event published by the system or application. At the same time, the [onReceiveEvent()](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md#staticsubscriberextensionabilityonreceiveevent) callback is triggered, in which you can implement the service logic. For example, if an application needs to execute some initialization tasks during device power-on, the application can subscribe to the power-on event in static mode. After receiving the power-on event, the application is started to execute the initialization tasks.
You can implement the service logic in the [onReceiveEvent()](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md#staticsubscriberextensionabilityonreceiveevent) callback. For example, if an application needs to execute some initialization tasks during device power-on, the application can subscribe to the power-on event in static mode. After receiving the power-on event, the application is started to execute the initialization tasks.
Subscribing to a common event in static mode is achieved by configuring a declaration file and implementing a class that inherits from [StaticSubscriberExtensionAbility](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md). Subscribing to a common event in static mode is achieved by configuring a declaration file and implementing a class that inherits from [StaticSubscriberExtensionAbility](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md).
...@@ -18,7 +16,7 @@ Subscribing to a common event in static mode is achieved by configuring a declar ...@@ -18,7 +16,7 @@ Subscribing to a common event in static mode is achieved by configuring a declar
To declare a static subscriber, create an ExtensionAbility, which is derived from the **StaticSubscriberExtensionAbility** class, in the project. To declare a static subscriber, create an ExtensionAbility, which is derived from the **StaticSubscriberExtensionAbility** class, in the project.
You can implement service logic in the **onReceiveEvent()** callback. You can implement service logic in the [**onReceiveEvent()**](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md#staticsubscriberextensionabilityonreceiveevent) callback.
```ts ```ts
import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility' import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility'
...@@ -93,26 +91,24 @@ Subscribing to a common event in static mode is achieved by configuring a declar ...@@ -93,26 +91,24 @@ Subscribing to a common event in static mode is achieved by configuring a declar
- **permission**: permission required for the publisher. If a publisher without the required permission attempts to publish an event, the event is regarded as invalid and will not be published. - **permission**: permission required for the publisher. If a publisher without the required permission attempts to publish an event, the event is regarded as invalid and will not be published.
- **events**: list of target events to subscribe to. - **events**: list of target events to subscribe to.
4. Modify the [preset configuration file](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/preinstall-config/install_list_permissions.json) of the device, that is, the **/system/etc/app/install_list_permission.json** file on the device. When the device is started, this file is read. During application installation, the common event type specified by **allowCommonEvent** in the file is authorized. The **install_list_permission.json** file contains the following fields: 4. Modify the [preset configuration file](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/preinstall-config/install_list_capability.json) of the device, that is, the **/system/etc/app/install_list_capability.json** file on the device. When the device is started, this file is read. During application installation, the common event type specified by **allowCommonEvent** in the file is authorized. The **install_list_capability.json** file contains the following fields:
- **bundleName**: bundle name of the application. - **bundleName**: bundle name of the application.
- **app_signature**: fingerprint information of the application. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md#configuration-in-install_list_capabilityjson). - **app_signature**: fingerprint information of the application. For details, see [Configuration in install_list_capability.json](../../device-dev/subsystems/subsys-app-privilege-config-guide.md#configuration-in-install_list_capabilityjson).
- **allowCommonEvent**: type of common event that can be started by static broadcast. - **allowCommonEvent**: type of common event that can be started by static broadcast.
> **NOTE**
>
> The **install_list_permissions.json** file is available only for preinstalled applications.
```json ```json
[ [
... ...
{ {
"bundleName": "com.example.myapplication", // Bundle name of the application. "bundleName": "com.example.myapplication", // Bundle name.
"app_signature": ["****"], // Fingerprint information of the application. "app_signature": ["****"], // Fingerprint information.
"allowCommonEvent": ["usual.event.A", "usual.event.B"], // Type of common event that can be started by static broadcast. "allowCommonEvent": ["usual.event.A", "usual.event.B"] // Type of common event that can be started by static broadcast.
]
} }
] ]
``` ```
<!--no_check--> > **NOTE**
\ No newline at end of file >
> The **install_list_capability.json** file is available only for preinstalled applications.
# Data Synchronization Between UIAbility and UI # Data Synchronization Between UIAbility and UI Page
Based on the OpenHarmony application model, you can use any of the following ways to implement data synchronization between the UIAbility component and UI: Based on the OpenHarmony application model, you can use any of the following ways to implement data synchronization between UIAbility components and UI pages:
- [Using EventHub for Data Synchronization](#using-eventhub-for-data-synchronization): The **EventHub** object is provided by the base class **Context**. Events are transferred using the publish/subscribe (pub/sub) pattern. Specifically, after subscribing to an event, your application will receive the event and process it accordingly when the event is published. - [Using EventHub for Data Synchronization](#using-eventhub-for-data-synchronization): The **EventHub** object is provided by the base class **Context**. It allows events to be transferred using the publish/subscribe (pub/sub) pattern. Specifically, after subscribing to an event, your application will receive the event and process it accordingly when the event is published.
- [Using globalThis for Data Synchronization](#using-globalthis-for-data-synchronization): **globalThis** is a global object inside the ArkTS engine instance and can be accessed by components such as UIAbility, ExtensionAbility, and Page. - [Using globalThis for Data Synchronization](#using-globalthis-for-data-synchronization): **globalThis** is a global object inside the ArkTS engine instance and can be accessed by the UIAbility components, ExtensionAbility components, and ArkUI pages inside the instance.
- [Using AppStorage or LocalStorage for Data Synchronization](#using-appstorage-or-localstorage-for-data-synchronization): ArkUI provides two application-level state management solutions: AppStorage and LocalStorage, which implement application- and UIAbility-level data synchronization, respectively. - [Using AppStorage or LocalStorage for Data Synchronization](#using-appstorage-or-localstorage-for-data-synchronization): ArkUI provides two application-level state management solutions: AppStorage and LocalStorage, which implement application- and UIAbility-level data synchronization, respectively.
## Using EventHub for Data Synchronization ## Using EventHub for Data Synchronization
[EventHub](../reference/apis/js-apis-inner-application-eventHub.md) provides an event mechanism for the UIAbility or ExtensionAbility component so that they can subscribe to, unsubscribe from, and trigger events. [EventHub](../reference/apis/js-apis-inner-application-eventHub.md) provides an event mechanism for the UIAbility component so that they can subscribe to, unsubscribe from, and trigger events.
Before using the APIs provided by **EventHub**, you must obtain an **EventHub** object, which is provided by the [base class Context](application-context-stage.md). This section uses EventHub as an example to describe how to implement data synchronization between the UIAbility component and the UI. Before using the APIs provided by **EventHub**, you must obtain an **EventHub** object, which is provided by the [base class Context](application-context-stage.md).
1. Call [eventHub.on()](../reference/apis/js-apis-inner-application-eventHub.md#eventhubon) in the UIAbility in either of the following ways to register a custom event **event1**. 1. Call [eventHub.on()](../reference/apis/js-apis-inner-application-eventHub.md#eventhubon) in the UIAbility in either of the following ways to register a custom event **event1**.
...@@ -40,7 +40,7 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub** ...@@ -40,7 +40,7 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub**
} }
``` ```
2. Call [eventHub.emit()](../reference/apis/js-apis-inner-application-eventHub.md#eventhubemit) on the UI to trigger the event, and pass the parameters as required. 2. Call [eventHub.emit()](../reference/apis/js-apis-inner-application-eventHub.md#eventhubemit) on the UI page to trigger the event, and pass in the parameters as required.
```ts ```ts
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
...@@ -60,14 +60,14 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub** ...@@ -60,14 +60,14 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub**
// You can design the parameters based on your service requirements. // You can design the parameters based on your service requirements.
} }
// Page display. // UI page display.
build() { build() {
... ...
} }
} }
``` ```
3. Obtain the event trigger result from the subscription callback of UIAbility. The run log result is as follows: 3. Obtain the event trigger result from the subscription callback of the UIAbility. The run log result is as follows:
```ts ```ts
[] []
...@@ -77,7 +77,7 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub** ...@@ -77,7 +77,7 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub**
[2,'test'] [2,'test']
``` ```
4. After **event1** is used, you can call [eventHub.off()](../reference/apis/js-apis-inner-application-eventHub.md#eventhuboff) to unsubscribe from the event. 4. When **event1** is not needed, call [eventHub.off()](../reference/apis/js-apis-inner-application-eventHub.md#eventhuboff) to unsubscribe from the event.
```ts ```ts
// context is the AbilityContext of the UIAbility instance. // context is the AbilityContext of the UIAbility instance.
...@@ -87,7 +87,7 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub** ...@@ -87,7 +87,7 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub**
## Using globalThis for Data Synchronization ## Using globalThis for Data Synchronization
**globalThis** is a global object inside the [ArkTS engine instance](thread-model-stage.md) and can be used by UIAbility, ExtensionAbility, and Page inside the engine. Therefore, you can use **globalThis** for data synchronization. **globalThis** is a global object inside the [ArkTS engine instance](thread-model-stage.md) and can be used by UIAbility, ExtensionAbility, and UI page inside the engine. Therefore, you can use **globalThis** for data synchronization.
**Figure 1** Using globalThis for data synchronization **Figure 1** Using globalThis for data synchronization
![globalThis1](figures/globalThis1.png) ![globalThis1](figures/globalThis1.png)
...@@ -95,16 +95,16 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub** ...@@ -95,16 +95,16 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub**
The following describes how to use **globalThis** in three scenarios. Precautions are provided as well. The following describes how to use **globalThis** in three scenarios. Precautions are provided as well.
- [Using globalThis Between UIAbility and Page](#using-globalthis-between-uiability-and-page) - [Using globalThis Between UIAbility and UI Page](#using-globalthis-between-uiability-and-ui-page)
- [Using globalThis Between UIAbility and UIAbility](#using-globalthis-between-uiability-and-uiability) - [Using globalThis Between UIAbility and UIAbility](#using-globalthis-between-uiability-and-uiability)
- [Use globalThis Between UIAbility and ExtensionAbility](#using-globalthis-between-uiability-and-extensionability) - [Using globalThis Between UIAbility and ExtensionAbility](#using-globalthis-between-uiability-and-extensionability)
- [Precautions for Using globalThis](#precautions-for-using-globalthis) - [Precautions for Using globalThis](#precautions-for-using-globalthis)
### Using globalThis Between UIAbility and Page ### Using globalThis Between UIAbility and UI Page
By binding attributes or methods to **globalThis**, you can implement data synchronization between the UIAbility component and UI. For example, if you bind the **want** parameter in the UIAbility component, you can use the **want** parameter information on the UI corresponding to the UIAbility component. To implement data synchronization between the UIAbility component and UI page, you can bind attributes or methods to **globalThis**. For example, if you bind the **want** parameter in the UIAbility component, you can use the **want** parameter information on the UI page corresponding to the UIAbility component.
1. When [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called to start a UIAbility instance, the [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) callback is invoked, and the **want** parameter can be passed in the callback. Therefore, you can bind the **want** parameter to **globalThis**. 1. When [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called to start a UIAbility instance, the [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) callback is invoked, and the **want** parameter can be passed in the callback. Bind the **want** parameter to **globalThis**.
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
...@@ -119,7 +119,7 @@ By binding attributes or methods to **globalThis**, you can implement data synch ...@@ -119,7 +119,7 @@ By binding attributes or methods to **globalThis**, you can implement data synch
} }
``` ```
2. Use **globalThis** on the UI to obtain the **want** parameter information. 2. Use **globalThis** on the UI page to obtain the **want** parameter information.
```ts ```ts
let entryAbilityWant; let entryAbilityWant;
...@@ -131,7 +131,7 @@ By binding attributes or methods to **globalThis**, you can implement data synch ...@@ -131,7 +131,7 @@ By binding attributes or methods to **globalThis**, you can implement data synch
entryAbilityWant = globalThis.entryAbilityWant; entryAbilityWant = globalThis.entryAbilityWant;
} }
// Page display. // UI page display.
build() { build() {
... ...
} }
...@@ -143,7 +143,7 @@ By binding attributes or methods to **globalThis**, you can implement data synch ...@@ -143,7 +143,7 @@ By binding attributes or methods to **globalThis**, you can implement data synch
To implement data synchronization between two UIAbility components in the same application, you can bind data to **globalThis**. For example, you can save data in **globalThis** in UIAbilityA and obtain the data from UIAbilityB. To implement data synchronization between two UIAbility components in the same application, you can bind data to **globalThis**. For example, you can save data in **globalThis** in UIAbilityA and obtain the data from UIAbilityB.
1. UIAbilityA stores a string and binds it to globalThis. 1. Save data in UIAbilityA and bind it to **globalThis**.
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
...@@ -175,7 +175,7 @@ To implement data synchronization between two UIAbility components in the same a ...@@ -175,7 +175,7 @@ To implement data synchronization between two UIAbility components in the same a
To implement data synchronization between the UIAbility and ExtensionAbility components in the same application, you can bind data to **globalThis**. For example, you can save data in **globalThis** in UIAbilityA and obtain the data from ServiceExtensionAbility. To implement data synchronization between the UIAbility and ExtensionAbility components in the same application, you can bind data to **globalThis**. For example, you can save data in **globalThis** in UIAbilityA and obtain the data from ServiceExtensionAbility.
1. UIAbilityA stores a string and binds it to globalThis. 1. Save data in UIAbilityA and bind it to **globalThis**.
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
...@@ -206,18 +206,20 @@ To implement data synchronization between the UIAbility and ExtensionAbility com ...@@ -206,18 +206,20 @@ To implement data synchronization between the UIAbility and ExtensionAbility com
### Precautions for Using globalThis ### Precautions for Using globalThis
**Figure 2** Precautions for globalThis **Figure 2** Precautions for using globalThis
![globalThis2](figures/globalThis2.png) ![globalThis2](figures/globalThis2.png)
- In the stage model, all the UIAbility components in a process share one ArkTS engine instance. When using **globalThis**, do not store objects with the same name. For example, if UIAbilityA and UIAbilityB use **globalThis** to store two objects with the same name, the object stored earlier will be overwritten. - In the stage model, all the UIAbility components in a process share one ArkTS engine instance. When using **globalThis**, do not store objects with the same name. For example, if UIAbilityA and UIAbilityB use **globalThis** to store two objects with the same name, the object stored earlier will be overwritten.
- **globalThis** cannot be used across processes. The UIAbility and ExtensionAbility components of different processes cannot use **globalThis** to share data. For details about the process model and inter-process communication, see [Process Model Overview](./process-model-stage.md#process-model-overview).
- This problem does not occur in the FA model because each UIAbility component uses an independent engine. - This problem does not occur in the FA model because each UIAbility component uses an independent engine.
- The lifecycle of an object bound to **globalThis** is the same as that of the ArkTS engine instance. You are advised to assign the value **null** after using the object to minimize memory usage. - The lifecycle of an object bound to **globalThis** is the same as that of the ArkTS engine instance. To minimize memory usage, you are advised to assign the value **null** to the object when it is not in use.
The following provides an example to describe the object overwritten problem in the stage model. The following provides an example to describe the object overwritten problem in the stage model.
1. In the UIAbilityA file, [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) is stored in **globalThis**. 1. In the UIAbilityA file, use **globalThis** to store [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md).
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
...@@ -230,7 +232,7 @@ The following provides an example to describe the object overwritten problem in ...@@ -230,7 +232,7 @@ The following provides an example to describe the object overwritten problem in
} }
``` ```
2. Obtain and use [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) on the page of UIAbilityA. After the UIAbilityA instance is used, switch it to the background. 2. Obtain and use [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) on the UI page of UIAbilityA. When the UIAbilityA instance is not in use, switch it to the background.
```ts ```ts
@Entry @Entry
...@@ -239,14 +241,14 @@ The following provides an example to describe the object overwritten problem in ...@@ -239,14 +241,14 @@ The following provides an example to describe the object overwritten problem in
onPageShow() { onPageShow() {
let ctx = globalThis.context; // Obtain the context from globalThis and use it. let ctx = globalThis.context; // Obtain the context from globalThis and use it.
} }
// Page display. // UI page display.
build() { build() {
... ...
} }
} }
``` ```
3. In the UIAbilityB file, [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) is stored in **globalThis** and has the same name as that in the UIAbilityA file. 3. In the UIAbilityB file, use **globalThis** to store [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md), which is named the same as that in the UIAbilityA file.
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
...@@ -260,7 +262,7 @@ The following provides an example to describe the object overwritten problem in ...@@ -260,7 +262,7 @@ The following provides an example to describe the object overwritten problem in
} }
``` ```
4. Obtain and use [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) on the page of UIAbilityB. The obtained **globalThis.context** is the value of [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) in UIAbilityB. 4. Obtain [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) from the UI page of UIAbilityB and use it. The obtained **globalThis.context** is the value of [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) in UIAbilityB.
```ts ```ts
@Entry @Entry
...@@ -269,7 +271,7 @@ The following provides an example to describe the object overwritten problem in ...@@ -269,7 +271,7 @@ The following provides an example to describe the object overwritten problem in
onPageShow() { onPageShow() {
let ctx = globalThis.context; // Obtain the context from globalThis and use it. let ctx = globalThis.context; // Obtain the context from globalThis and use it.
} }
// Page display. // UI page display.
build() { build() {
... ...
} }
...@@ -289,7 +291,7 @@ The following provides an example to describe the object overwritten problem in ...@@ -289,7 +291,7 @@ The following provides an example to describe the object overwritten problem in
} }
``` ```
6. When the page of UIAbilityA is displayed, the obtained **globalThis.context** is [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) of UIAbilityB instead of UIAbilityA. An error occurs. 6. When the UI page of UIAbilityA is displayed, the obtained **globalThis.context** is the value of [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) of UIAbilityB instead of UIAbilityA. An error occurs.
```ts ```ts
@Entry @Entry
...@@ -298,7 +300,7 @@ The following provides an example to describe the object overwritten problem in ...@@ -298,7 +300,7 @@ The following provides an example to describe the object overwritten problem in
onPageShow() { onPageShow() {
let ctx = globalThis.context; // The context in globalThis is the context of UIAbilityB. let ctx = globalThis.context; // The context in globalThis is the context of UIAbilityB.
} }
// Page display. // UI page display.
build() { build() {
... ...
} }
...@@ -307,4 +309,4 @@ The following provides an example to describe the object overwritten problem in ...@@ -307,4 +309,4 @@ The following provides an example to describe the object overwritten problem in
## Using AppStorage or LocalStorage for Data Synchronization ## Using AppStorage or LocalStorage for Data Synchronization
ArkUI provides AppStorage and LocalStorage to implement application- and UIAbility-level data synchronization, respectively. Both solutions can be used to manage the application state, enhance application performance, and improve user experience. The AppStorage is a global state manager and is applicable when multiple UIAbilities share the same state data. The LocalStorage is a local state manager that manages state data used inside a single UIAbility. They help you control the application state more flexibly and improve the maintainability and scalability of applications. For details, see [State Management of Application-Level Variables](../quick-start/arkts-application-state-management-overview.md). ArkUI provides AppStorage and LocalStorage to implement application- and UIAbility-level data synchronization, respectively. Both solutions can be used to manage the application state, enhance application performance, and improve user experience. The AppStorage is a global state manager that manages state data shared among multiple UIAbilities. The LocalStorage is a local state manager that manages state data used inside a single UIAbility. They help you control the application state more flexibly and improve the maintainability and scalability of applications. For details, see [State Management of Application-Level Variables](../quick-start/arkts-application-state-management-overview.md).
...@@ -11,7 +11,6 @@ The application sandbox is an isolation mechanism to prevent data from being acc ...@@ -11,7 +11,6 @@ The application sandbox is an isolation mechanism to prevent data from being acc
The following figure illustrates the file access scope and modes for an application in an application sandbox. The following figure illustrates the file access scope and modes for an application in an application sandbox.
**Figure 1** File access in an application sandbox **Figure 1** File access in an application sandbox
![Application sandbox file access relationship](figures/application-sandbox-file-access-relationship.png) ![Application sandbox file access relationship](figures/application-sandbox-file-access-relationship.png)
## Application Sandbox Directory and Application Sandbox Path ## Application Sandbox Directory and Application Sandbox Path
...@@ -22,10 +21,9 @@ With the application sandbox mechanism, an application cannot learn the location ...@@ -22,10 +21,9 @@ With the application sandbox mechanism, an application cannot learn the location
- You can view the real application paths (the directory view visible to a system process) in the HDC shell environment. For details about the mappings between the application sandbox paths and real application paths, see [Mappings Between Application Sandbox Paths and Physical Paths](send-file-to-app-sandbox.md#mappings-between-application-sandbox-paths-and-physical-paths). - You can view the real application paths (the directory view visible to a system process) in the HDC shell environment. For details about the mappings between the application sandbox paths and real application paths, see [Mappings Between Application Sandbox Paths and Physical Paths](send-file-to-app-sandbox.md#mappings-between-application-sandbox-paths-and-physical-paths).
- The application sandbox paths and physical paths are not in one-to-one mappings. The application sandbox paths are always less than the physical paths. You may not obtain the the application sandbox path based on a physical path in certain cases, but you can obtain the physical path based on an application sandbox path. - The application sandbox paths and physical paths are not in one-to-one mappings. The application sandbox paths are always less than the physical paths. You may not obtain the application sandbox path based on a physical path in certain cases, but you can obtain the physical path based on an application sandbox path.
**Figure 2** Different directory views to processes and applications **Figure 2** Different directory views to processes and applications
![Application sandbox path](figures/application-sandbox-path.png) ![Application sandbox path](figures/application-sandbox-path.png)
## Application File Directory and Application File Path ## Application File Directory and Application File Path
...@@ -37,7 +35,6 @@ The system file directories visible to an application are preset by OpenHarmony. ...@@ -37,7 +35,6 @@ The system file directories visible to an application are preset by OpenHarmony.
The following figure shows the application file directories. The path of a file or a folder in the application file directory is called the application file path. The file paths in the application file directory have different attributes and characteristics. The following figure shows the application file directories. The path of a file or a folder in the application file directory is called the application file path. The file paths in the application file directory have different attributes and characteristics.
**Figure 3** Application file directory structure **Figure 3** Application file directory structure
![Application file directory structure](figures/application-file-directory-structure.png) ![Application file directory structure](figures/application-file-directory-structure.png)
1. Level 1 directory **data/**: indicates the application file directory. 1. Level 1 directory **data/**: indicates the application file directory.
...@@ -67,8 +64,8 @@ The following figure shows the application file directories. The path of a file ...@@ -67,8 +64,8 @@ The following figure shows the application file directories. The path of a file
| Folder| Context Attribute Name| Type| Description| | Folder| Context Attribute Name| Type| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| bundle | bundleCodeDir | Installation file directory| Directory for saving the HAPs of the application after an application is installed.<br>This directory is cleared when the application is uninstalled.<br> Do not access resource files by concatenating paths. Use [@ohos.resourceManager] instead.| | bundle | bundleCodeDir | Installation file directory| Directory for saving the HAPs of the application after an application is installed.<br>This directory is cleared when the application is uninstalled.<br> Do not access resource files by concatenating paths. Use [@ohos.resourceManager](../reference/apis/js-apis-resource-manager.md) instead. |
| base | NA | Directory for local device files| Directory for saving the application's persistent data on the device. Subdirectories include **files/**,** cache/**, **temp/**, and **haps/**.<br>This directory is cleared when the application is uninstalled.| | base | NA | Directory for local device files| Directory for saving the application's persistent data on the device. Subdirectories include **files/**, **cache/**, **temp/**, and **haps/**.<br>This directory is cleared when the application is uninstalled.|
| database | databaseDir | Database directory| Directory in **el1** for saving the files operated by the distributed database service.<br>This directory is cleared when the application is uninstalled.| | database | databaseDir | Database directory| Directory in **el1** for saving the files operated by the distributed database service.<br>This directory is cleared when the application is uninstalled.|
| distributedfiles | distributedFilesDir | Distributed file directory| Directory in **el2** for saving the application files that can be directly accessed across devices.<br>This directory is cleared when the application is uninstalled.| | distributedfiles | distributedFilesDir | Distributed file directory| Directory in **el2** for saving the application files that can be directly accessed across devices.<br>This directory is cleared when the application is uninstalled.|
| files | filesDir | Application file directory| Directory for saving the application's persistent files on the device.<br>This directory is cleared when the application is uninstalled.| | files | filesDir | Application file directory| Directory for saving the application's persistent files on the device.<br>This directory is cleared when the application is uninstalled.|
......
...@@ -12,7 +12,7 @@ This topic describes only the AppStorage application scenarios and related decor ...@@ -12,7 +12,7 @@ This topic describes only the AppStorage application scenarios and related decor
## Overview ## Overview
AppStorage is a singleton LocalStorage object that is created by the UI framework at application startup. Its purpose is to provide the central storage for mutable application UI state attributes. AppStorage retains all those attributes and their values as long as the application remains running. Attributes are accessed using a unique key string value. AppStorage is a singleton object that is created at application startup. Its purpose is to provide the central storage for mutable application UI state attributes. AppStorage retains all those attributes and their values as long as the application remains running. Attributes are accessed using a unique key string value.
UI components synchronize application state attributes with the AppStorage. Implementation of application business logic can access AppStorage as well. UI components synchronize application state attributes with the AppStorage. Implementation of application business logic can access AppStorage as well.
...@@ -21,7 +21,7 @@ Selected state attributes of AppStorage can be synced with different data source ...@@ -21,7 +21,7 @@ Selected state attributes of AppStorage can be synced with different data source
## \@StorageProp ## \@StorageProp
As mentioned above, if you want to establish a binding between AppStorage and a custom component, you need to use the \@StorageProp and \@StorageLink decorators. Use \@StorageProp(key) or \@StorageLink(key) to decorate variables in the component. **key** identifies the attribute in AppStorage. As mentioned above, if you want to establish a binding between AppStorage and a custom component, you'll need the \@StorageProp and \@StorageLink decorators. Use \@StorageProp(key) or \@StorageLink(key) to decorate variables in the component, where **key** identifies the attribute in AppStorage.
When a custom component is initialized, the \@StorageProp(key)/\@StorageLink(key) decorated variable is initialized with the value of the attribute with the given key in AppStorage. Local initialization is mandatory. If an attribute with the given key is missing from AppStorage, it will be added with the stated initializing value. (Whether the attribute with the given key exists in AppStorage depends on the application logic.) When a custom component is initialized, the \@StorageProp(key)/\@StorageLink(key) decorated variable is initialized with the value of the attribute with the given key in AppStorage. Local initialization is mandatory. If an attribute with the given key is missing from AppStorage, it will be added with the stated initializing value. (Whether the attribute with the given key exists in AppStorage depends on the application logic.)
...@@ -44,7 +44,7 @@ By decorating a variable with \@StorageProp(key), a one-way data synchronization ...@@ -44,7 +44,7 @@ By decorating a variable with \@StorageProp(key), a one-way data synchronization
| Transfer/Access | Description | | Transfer/Access | Description |
| ---------- | ---------------------------------------- | | ---------- | ---------------------------------------- |
| Initialization and update from the parent component| Forbidden.| | Initialization and update from the parent component| Forbidden.|
| Subnode initialization | Supported; can be used to initialize a n \@State, \@Link, \@Prop, or \@Provide decorated variable in the child component.| | Subnode initialization | Supported; can be used to initialize an \@State, \@Link, \@Prop, or \@Provide decorated variable in the child component.|
| Access | None. | | Access | None. |
...@@ -193,6 +193,181 @@ struct CompA { ...@@ -193,6 +193,181 @@ struct CompA {
} }
``` ```
### Persistent Subscription and Callback
The persistent subscription and callback can help reduce overhead and enhance code readability.
```ts
// xxx.ets
import emitter from '@ohos.events.emitter';
let NextID: number = 0;
class ViewData {
title: string;
uri: Resource;
color: Color = Color.Black;
id: number;
constructor(title: string, uri: Resource) {
this.title = title;
this.uri = uri
this.id = NextID++;
}
}
@Entry
@Component
struct Gallery2 {
dataList: Array<ViewData> = [new ViewData('flower', $r('app.media.icon')), new ViewData('OMG', $r('app.media.icon')), new ViewData('OMG', $r('app.media.icon'))]
scroller: Scroller = new Scroller()
private preIndex: number = -1
build() {
Column() {
Grid(this.scroller) {
ForEach(this.dataList, (item: ViewData) => {
GridItem() {
TapImage({
uri: item.uri,
index: item.id
})
}.aspectRatio(1)
.onClick(() => {
if (this.preIndex === item.id) {
return
}
var innerEvent = { eventId: item.id }
// Selected: from black to red
var eventData = {
data: {
"colorTag": 1
}
}
emitter.emit(innerEvent, eventData)
if (this.preIndex != -1) {
console.info(`preIndex: ${this.preIndex}, index: ${item.id}, black`)
var innerEvent = { eventId: this.preIndex }
// Deselected: from red to black
var eventData = {
data: {
"colorTag": 0
}
}
emitter.emit(innerEvent, eventData)
}
this.preIndex = item.id
})
}, (item: ViewData) => JSON.stringify(item))
}.columnsTemplate('1fr 1fr')
}
}
}
@Component
export struct TapImage {
@State tapColor: Color = Color.Black;
private index: number;
private uri: Resource;
onTapIndexChange(colorTag: emitter.EventData) {
this.tapColor = colorTag.data.colorTag ? Color.Red : Color.Black
}
aboutToAppear() {
// Define the event ID.
var innerEvent = { eventId: this.index }
emitter.on(innerEvent, this.onTapIndexChange.bind(this))
}
build() {
Column() {
Image(this.uri)
.objectFit(ImageFit.Cover)
.border({ width: 5, style: BorderStyle.Dotted, color: this.tapColor })
}
}
}
```
The following example uses the message mechanism to subscribe to events. Because this mechanism can result in a large number of nodes to listen for and a long implementation time, it is not recommended.
```ts
// xxx.ets
class ViewData {
title: string;
uri: Resource;
color: Color = Color.Black;
constructor(title: string, uri: Resource) {
this.title = title;
this.uri = uri
}
}
@Entry
@Component
struct Gallery2 {
dataList: Array<ViewData> = [new ViewData('flower', $r('app.media.icon')), new ViewData('OMG', $r('app.media.icon')), new ViewData('OMG', $r('app.media.icon'))]
scroller: Scroller = new Scroller()
build() {
Column() {
Grid(this.scroller) {
ForEach(this.dataList, (item: ViewData, index?: number) => {
GridItem() {
TapImage({
uri: item.uri,
index: index
})
}.aspectRatio(1)
}, (item: ViewData, index?: number) => {
return JSON.stringify(item) + index;
})
}.columnsTemplate('1fr 1fr')
}
}
}
@Component
export struct TapImage {
@StorageLink('tapIndex') @Watch('onTapIndexChange') tapIndex: number = -1;
@State tapColor: Color = Color.Black;
private index: number;
private uri: Resource;
// Check whether the component is selected.
onTapIndexChange() {
if (this.tapIndex >= 0 && this.index === this.tapIndex) {
console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, red`)
this.tapColor = Color.Red;
} else {
console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, black`)
this.tapColor = Color.Black;
}
}
build() {
Column() {
Image(this.uri)
.objectFit(ImageFit.Cover)
.onClick(() => {
this.tapIndex = this.index;
})
.border({ width: 5, style: BorderStyle.Dotted, color: this.tapColor })
}
}
}
```
## Restrictions ## Restrictions
...@@ -201,3 +376,6 @@ When using AppStorage together with [PersistentStorage](arkts-persiststorage.md) ...@@ -201,3 +376,6 @@ When using AppStorage together with [PersistentStorage](arkts-persiststorage.md)
- A call to **PersistentStorage.PersistProp()** after creating the attribute in AppStorage uses the type and value in AppStorage and overwrites any attribute with the same name in PersistentStorage. In light of this, the opposite order of calls is recommended. For an example of incorrect usage, see [Accessing Attribute in AppStorage Before PersistentStorage](arkts-persiststorage.md#accessing-attribute-in-appstorage-before-persistentstorage). - A call to **PersistentStorage.PersistProp()** after creating the attribute in AppStorage uses the type and value in AppStorage and overwrites any attribute with the same name in PersistentStorage. In light of this, the opposite order of calls is recommended. For an example of incorrect usage, see [Accessing Attribute in AppStorage Before PersistentStorage](arkts-persiststorage.md#accessing-attribute-in-appstorage-before-persistentstorage).
- A call to **Environment.EnvProp()** after creating the attribute in AppStorage will fail. This is because AppStorage already has an attribute with the same name, and the environment variable will not be written into AppStorage. Therefore, you are advised not to use the preset environment variable name in AppStorage. - A call to **Environment.EnvProp()** after creating the attribute in AppStorage will fail. This is because AppStorage already has an attribute with the same name, and the environment variable will not be written into AppStorage. Therefore, you are advised not to use the preset environment variable name in AppStorage.
- Changes to the variables decorated by state decorators will cause UI re-render. If the changes are for message communication, rather than for UI re-render, the emitter mode is recommended. For the example, see [Persistent Subscription and Callback](#persistent-subscription-and-callback).
<!--no_check-->
...@@ -9,7 +9,7 @@ This topic describes only the LocalStorage application scenarios and related dec ...@@ -9,7 +9,7 @@ This topic describes only the LocalStorage application scenarios and related dec
> **NOTE** > **NOTE**
> >
> This module is supported since API version 9. > LocalStorage is supported since API version 9.
## Overview ## Overview
...@@ -292,7 +292,7 @@ struct CompA { ...@@ -292,7 +292,7 @@ struct CompA {
.onClick(() => this.storLink += 1) .onClick(() => this.storLink += 1)
// You are not advised to use the global variable linkToPropA.get() in the component because errors may occur due to different life cycles. // Avoid using the global variable linkToPropA.get() in the component. Doing so may cause errors due to different lifecycles.
Text(`@LocalStorageLink: ${this.storLink} - linkToPropA: ${linkToPropA.get()}`) Text(`@LocalStorageLink: ${this.storLink} - linkToPropA: ${linkToPropA.get()}`)
} }
} }
...@@ -306,7 +306,7 @@ This example shows how to use \@LocalStorageLink to create a two-way synchroniza ...@@ -306,7 +306,7 @@ This example shows how to use \@LocalStorageLink to create a two-way synchroniza
Check the changes in the **Parent** custom component. Check the changes in the **Parent** custom component.
1. Clicking **countStorage ${this.playCount} incr by 1** decreases the value of **this.playCount** by 1. This change is synchronized to LocalStorage and to the components bound to **playCountLink** in the **Child** component. 1. Clicking **playCount ${this.playCount} dec by 1** decreases the value of **this.playCount** by 1. This change is synchronized to LocalStorage and to the components bound to **playCountLink** in the **Child** component.
2. Click **countStorage ${this.playCount} incr by 1** to call the **set** API in LocalStorage to update the attributes corresponding to **countStorage** in LocalStorage. The components bound to** playCountLink** in the **Child** component are updated synchronously. 2. Click **countStorage ${this.playCount} incr by 1** to call the **set** API in LocalStorage to update the attributes corresponding to **countStorage** in LocalStorage. The components bound to** playCountLink** in the **Child** component are updated synchronously.
...@@ -379,7 +379,7 @@ Changes in the **Child** custom component: ...@@ -379,7 +379,7 @@ Changes in the **Child** custom component:
### Sharing a LocalStorage Instance from UIAbility to One or More Pages ### Sharing a LocalStorage Instance from UIAbility to One or More Pages
In the preceding examples, the LocalStorage instance is shared only in an \@Entry decorated component and its owning child component (a page). To enable a LocalStorage instance to be shared across pages, you can create a LocalStorage instance in the owning UIAbility and call windowStage.[loadContent](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-window.md#loadcontent9). In the preceding examples, the LocalStorage instance is shared only in an \@Entry decorated component and its owning child component (a page). To enable a LocalStorage instance to be shared across pages, you can create a LocalStorage instance in the owning UIAbility and call windowStage.[loadContent](../reference/apis/js-apis-window.md#loadcontent9).
```ts ```ts
......
...@@ -15,7 +15,7 @@ The decorators described above can observe only the changes of the first layer. ...@@ -15,7 +15,7 @@ The decorators described above can observe only the changes of the first layer.
- Regarding classes decorated by \@Observed, the attribute changes can be observed. - Regarding classes decorated by \@Observed, the attribute changes can be observed.
- The \@ObjectLink decorated state variable in the child component is used to accept the instance of the \@Observed decorated class and establish two-way data binding with the corresponding state variable in the parent component. The instance can be an \@Observed decorated item in the array or an \@Observeddecorated attribute in the class object. - The \@ObjectLink decorated state variable in the child component is used to accept the instance of the \@Observed decorated class and establish two-way data binding with the corresponding state variable in the parent component. The instance can be an \@Observed decorated item in the array or an \@Observed decorated attribute in the class object.
- Using \@Observed alone has no effect. Combined use with \@ObjectLink for two-way synchronization or with [\@Prop](arkts-prop.md) for one-way synchronization is required. - Using \@Observed alone has no effect. Combined use with \@ObjectLink for two-way synchronization or with [\@Prop](arkts-prop.md) for one-way synchronization is required.
...@@ -216,13 +216,13 @@ Event handlers in **ViewB**: ...@@ -216,13 +216,13 @@ Event handlers in **ViewB**:
- this.b.a = new ClassA(0) and this.b = new ClassB(new ClassA(0)): Change to the \@State decorated variable **b** and its attributes. - this.b.a = new ClassA(0) and this.b = new ClassB(new ClassA(0)): Change to the \@State decorated variable **b** and its attributes.
- this.b.a.c = ... : Second change. [@State](arkts-state.md#observed-changes) cannot observe the change of the second layer, but ClassA is decorated by \@Observed, and therefore the change of its attribute c can be observed by \@ObjectLink. - this.b.a.c = ... : Change at the second layer. Though [@State](arkts-state.md#observed-changes) cannot observe the change at the second layer, the change of an attribute of \@Observed decorated ClassA, which is attribute **c** in this example, can be observed by \@ObjectLink.
Event handlers in **ViewA**: Event handlers in **ViewA**:
- this.a.c += 1: Changes to the \@ObjectLink decorated variable which cause the button label to be updated. Unlike \@Prop, \@ObjectLink does not have a copy of its source. Instead, \@ObjectLink creates a reference to its source. - this.a.c += 1: Changes to the \@ObjectLink decorated variable cause the button label to be updated. Unlike \@Prop, \@ObjectLink does not have a copy of its source. Instead, \@ObjectLink creates a reference to its source.
- The \@ObjectLink decorated variable is read-only. Assigning **this.a = new ClassA(...)** is not allowed. Once value assignment occurs, the reference to the data source is reset and the synchronization is interrupted. - The \@ObjectLink decorated variable is read-only. Assigning **this.a = new ClassA(...)** is not allowed. Once value assignment occurs, the reference to the data source is reset and the synchronization is interrupted.
...@@ -300,7 +300,7 @@ struct ViewB { ...@@ -300,7 +300,7 @@ struct ViewB {
1. ForEach: The newly added Class A object is unknown to the **ForEach** [itemGenerator](arkts-rendering-control-foreach.md#api-description). The item builder of **ForEach** will be executed to create a **View A** component instance. 1. ForEach: The newly added Class A object is unknown to the **ForEach** [itemGenerator](arkts-rendering-control-foreach.md#api-description). The item builder of **ForEach** will be executed to create a **View A** component instance.
2. ViewA({ label: ViewA this.arrA[last], a: this.arrA[this.arrA.length-1] }): The last item of the array is changed. As a result, the second **View A** component instance is changed. For **ViewA({ label: ViewA this.arrA[first], a: this.arrA[0] })**, a change to the array does not trigger a change to the array item, so the first **View A** component instance is not refreshed. 2. ViewA({ label: ViewA this.arrA[last], a: this.arrA[this.arrA.length-1] }): The last item of the array is changed. As a result, the second **View A** component instance is changed. For **ViewA({ label: ViewA this.arrA[first], a: this.arrA[0] })**, a change to the array does not trigger a change to the array item, so the first **View A** component instance is not refreshed.
- this.arrA[Math.floor (this.arrA.length/2)].c: [@State](arkts-state.md#observed-changes) cannot observe changes in the second layer. However, as **ClassA** is decorated by \@Observed, the change of its attributes will be observed by \@ObjectLink. - this.arrA[Math.floor (this.arrA.length/2)].c: [@State](arkts-state.md#observed-changes) cannot observe changes at the second layer. However, as **ClassA** is decorated by \@Observed, the change of its attributes will be observed by \@ObjectLink.
### Two-Dimensional Array ### Two-Dimensional Array
......
...@@ -24,6 +24,7 @@ Persistence of data is a relatively slow operation. Applications should avoid th ...@@ -24,6 +24,7 @@ Persistence of data is a relatively slow operation. Applications should avoid th
The preceding situations may overload the change process of persisted data. As a result, the PersistentStorage implementation may limit the change frequency of persisted attributes. The preceding situations may overload the change process of persisted data. As a result, the PersistentStorage implementation may limit the change frequency of persisted attributes.
PersistentStorage can be called to persist data only when used in UI pages.
## Application Scenarios ## Application Scenarios
......
# \@Watch: Getting Notified of State Variable Changes # \@Watch Decorator: Getting Notified of State Variable Changes
\@Watch is used to listen for state variables. If your application needs watch for value changes of a state variable, you can decorate the variable with \@Watch. \@Watch is used to listen for state variables. If your application needs watch for value changes of a state variable, you can decorate the variable with \@Watch.
...@@ -27,7 +27,7 @@ An application can request to be notified whenever the value of the \@Watch deco ...@@ -27,7 +27,7 @@ An application can request to be notified whenever the value of the \@Watch deco
| Type | Description | | Type | Description |
| ---------------------------------------- | ---------------------------------------- | | ---------------------------------------- | ---------------------------------------- |
| (changedPropertyName?&nbsp;:&nbsp;string)&nbsp;=&gt;&nbsp;void | This function is a member function of the custom component. **changedPropertyName** indicates the name of the watched attribute.<br>It is useful when you use the same function as a callback to several watched attributes.<br>It takes the attribute name as a string input parameter and returns nothing.| | (changedPropertyName? : string) =&gt; void | This function is a member function of the custom component. **changedPropertyName** indicates the name of the watched attribute.<br>It is useful when you use the same function as a callback to several watched attributes.<br>It takes the attribute name as a string input parameter and returns nothing.|
## Observed Changes and Behavior ## Observed Changes and Behavior
...@@ -131,7 +131,7 @@ The processing procedure is as follows: ...@@ -131,7 +131,7 @@ The processing procedure is as follows:
### \@Watch and Custom Component Update ### \@Watch and Custom Component Update
This example is used to clarify the processing steps of custom component updates and \@Watch. Note that **count** is @State decorated in both components. This example is used to clarify the processing steps of custom component updates and \@Watch. **count** is decorated by \@State in **CountModifier** and \@Prop in **TotalView**.
```ts ```ts
......
...@@ -27,7 +27,7 @@ Table 2 describes the internal structure of the **deviceConfig** attributes. ...@@ -27,7 +27,7 @@ Table 2 describes the internal structure of the **deviceConfig** attributes.
| process | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. The value can contain a maximum of 31 characters.| String| Yes (initial value: left empty)| | process | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. The value can contain a maximum of 31 characters.| String| Yes (initial value: left empty)|
| keepAlive | Whether the application is always running. This attribute applies only to system applications and does not take effect for third-party applications. The value **true** means that the application will start during the OS startup and keep alive. If the application process exits, the OS will restart it.| Boolean| Yes (initial value: **false**)| | keepAlive | Whether the application is always running. This attribute applies only to system applications and does not take effect for third-party applications. The value **true** means that the application will start during the OS startup and keep alive. If the application process exits, the OS will restart it.| Boolean| Yes (initial value: **false**)|
| supportBackup | Whether the application supports backup and restoration. The value **false** means that the application does not support backup or restoration.| Boolean| Yes (initial value: **false**)| | supportBackup | Whether the application supports backup and restoration. The value **false** means that the application does not support backup or restoration.| Boolean| Yes (initial value: **false**)|
| compressNativeLibs | Whether the **libs** libraries are packaged in the HAP file after being compressed. The value **false** means that the **libs** libraries are stored without being compressed and will be directly loaded during the installation of the HAP file.| Boolean| Yes (initial value: **false**)| | compressNativeLibs | Whether the **libs** libraries are packaged in the HAP file after being compressed. The value **false** means that the **libs** libraries are stored without being compressed and will be directly loaded during the installation of the HAP file.| Boolean| Yes (initial value: **true**)|
| network | Network security configuration. You can customize the network security settings of the application in the security statement of the configuration file without modifying the application code.| Object| Yes (initial value: left empty)| | network | Network security configuration. You can customize the network security settings of the application in the security statement of the configuration file without modifying the application code.| Object| Yes (initial value: left empty)|
## Internal Structure of the network Attribute ## Internal Structure of the network Attribute
......
...@@ -219,7 +219,7 @@ The **metadata** tag represents the custom metadata of the HAP file. The tag val ...@@ -219,7 +219,7 @@ The **metadata** tag represents the custom metadata of the HAP file. The tag val
## abilities ## abilities
UIAbility configuration of the module, which is valid only for the current UIAbility component. The **abilities** tag represents the UIAbility configuration of the module, which is valid only for the current UIAbility component.
**Table 6** abilities **Table 6** abilities
......
# Development References # Development References
- [ArkTS API Reference](apis/Readme-EN.md)
- [SystemCapability](syscap.md) - [SystemCapability](syscap.md)
- [SystemCapability List](syscap-list.md) - [SystemCapability List](syscap-list.md)
- [Component Reference (ArkTS-based Declarative Development Paradigm)](arkui-ts/Readme-EN.md) - [Component Reference (ArkTS-based Declarative Development Paradigm)](arkui-ts/Readme-EN.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm)](arkui-js/Readme-EN.md) - [Component Reference (JavaScript-compatible Web-like Development Paradigm - ArkUI.Full)](arkui-js/Readme-EN.md)
- [JS Service Widget UI Component Reference](js-service-widget-ui/Readme-EN.md) - [Component Reference (JavaScript-compatible Web-like Development Paradigm - ArkUI.Lite)](arkui-js-lite/Readme-EN.md)
- [API Reference (ArkTS and JS APIs)](apis/Readme-EN.md) - [JavaScript Service Widget UI Component Reference](js-service-widget-ui/Readme-EN.md)
- [Error Codes](errorcodes/Readme-EN.md) - [Error Codes](errorcodes/Readme-EN.md)
- API Reference (Native APIs) - Native API Reference
- [OpenHarmony Native APIs](native-apis/Readme-EN.md)
- [Standard Libraries Supported by Native APIs](native-lib/Readme-EN.md) - [Standard Libraries Supported by Native APIs](native-lib/Readme-EN.md)
# @ohos.accessibility # @ohos.accessibility (Accessibility)
The **Accessibility** module implements the accessibility functions, including obtaining the accessibility application list, accessibility application enabled status, and captions configuration. The **Accessibility** module implements the accessibility functions, including obtaining the accessibility application list, accessibility application enabled status, and captions configuration.
...@@ -134,14 +134,14 @@ Describes the style of captions. ...@@ -134,14 +134,14 @@ Describes the style of captions.
**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing **System capability**: SystemCapability.BarrierFree.Accessibility.Hearing
| Name| Type| Readable| Writable| Description| | Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- | | --------------- | ---------------------------------------- | ---- | ---- | ----------- |
| fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | Yes| No| Font family of captions.| | fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | Yes | No | Font family of captions. |
| fontScale | number | Yes| No| Font scale of captions.| | fontScale | number | Yes | No | Font scale factor of captions, in percentage. The value ranges from 1 to 200.|
| fontColor | number \| string | Yes| No| Font color of captions.| | fontColor | number \| string | Yes | No | Font color of captions. For example, red corresponds to #FF0000. |
| fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | Yes| No| Font edge type of captions.| | fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | Yes | No | Font edge type of captions. |
| backgroundColor | number \| string | Yes| No| Background color of captions.| | backgroundColor | number \| string | Yes | No | Background color of captions. For example, red corresponds to #FF0000. |
| windowColor | number \| string | Yes| No| Window color of captions.| | windowColor | number \| string | Yes | No | Window color of captions. For example, red corresponds to #FF0000. |
## CaptionsManager<sup>8+</sup> ## CaptionsManager<sup>8+</sup>
......
...@@ -6,7 +6,7 @@ The **Animator** module provides APIs for applying animation effects, including ...@@ -6,7 +6,7 @@ The **Animator** module provides APIs for applying animation effects, including
> >
> The initial APIs of this module are supported since API version 6. 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 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> >
> This module can be used only after a component instance is created, and it cannot be used in the [UIAbility](./js-apis-app-ability-uiAbility.md). > This module cannot be used in the file declaration of the [UIAbility](./js-apis-app-ability-uiAbility.md). In other words, the APIs of this module can be used only after a component instance is created; they cannot be called in the lifecycle of the UIAbility.
## Modules to Import ## Modules to Import
...@@ -37,7 +37,9 @@ Creates an **Animator** object. ...@@ -37,7 +37,9 @@ Creates an **Animator** object.
**Example** **Example**
```js ```js
let options = { import animator, { AnimatorOptions } from '@ohos.animator';
let options: AnimatorOptions = { // The explicit type AnimatorOptions does not need to be emphasized in the xxx.js file.
duration: 1500, duration: 1500,
easing: "friction", easing: "friction",
delay: 0, delay: 0,
...@@ -46,8 +48,8 @@ Creates an **Animator** object. ...@@ -46,8 +48,8 @@ Creates an **Animator** object.
iterations: 3, iterations: 3,
begin: 200.0, begin: 200.0,
end: 400.0 end: 400.0
}; };
animator.create(options); animator.create(options);
``` ```
## AnimatorResult ## AnimatorResult
...@@ -80,7 +82,7 @@ For details about the error codes, see [Animator Error Codes](../errorcodes/erro ...@@ -80,7 +82,7 @@ For details about the error codes, see [Animator Error Codes](../errorcodes/erro
**Example** **Example**
```js ```js
let options = { let options: AnimatorOptions = { // The explicit type AnimatorOptions does not need to be emphasized in the xxx.js file.
duration: 1500, duration: 1500,
easing: "friction", easing: "friction",
delay: 0, delay: 0,
...@@ -513,7 +515,7 @@ This API is deprecated since API version 9. You are advised to use [create<sup>9 ...@@ -513,7 +515,7 @@ This API is deprecated since API version 9. You are advised to use [create<sup>9
**Example** **Example**
```js ```js
let options = { let options: AnimatorOptions = { // The explicit type AnimatorOptions does not need to be emphasized in the xxx.js file.
duration: 1500, duration: 1500,
easing: "friction", easing: "friction",
delay: 0, delay: 0,
......
# @ohos.application.DataShareExtensionAbility (DataShare Extension Ability) # @ohos.application.DataShareExtensionAbility (DataShare ExtensionAbility)
The **DataShareExtensionAbility** module provides data share services based on the ExtensionAbility. The **DataShareExtensionAbility** module provides data share services based on the ExtensionAbility.
...@@ -57,7 +57,7 @@ Called by the server to initialize service logic when the DataShare client conne ...@@ -57,7 +57,7 @@ Called by the server to initialize service logic when the DataShare client conne
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ | | ----- | ------ | ------ | ------ |
| want | [Want](js-apis-application-want.md#want) | Yes | **Want** information, including the ability name and bundle name.| | want | [Want](js-apis-application-want.md#want) | Yes | Want information, including the ability name and bundle name.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback that returns no value.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback that returns no value.|
**Example** **Example**
...@@ -78,10 +78,10 @@ export default class DataShareExtAbility extends DataShareExtensionAbility { ...@@ -78,10 +78,10 @@ export default class DataShareExtAbility extends DataShareExtensionAbility {
name: DB_NAME, name: DB_NAME,
securityLevel: rdb.SecurityLevel.S1 securityLevel: rdb.SecurityLevel.S1
}, function (err, data) { }, function (err, data) {
console.log('getRdbStore done, data : ' + data); console.info(`getRdbStore done, data : ${data}`);
rdbStore = data; rdbStore = data;
rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) { rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) {
console.log('executeSql done, error message : ' + err); console.error(`executeSql done, error message : ${err}`);
}); });
if (callback) { if (callback) {
callback(); callback();
...@@ -122,11 +122,11 @@ let rdbStore; ...@@ -122,11 +122,11 @@ let rdbStore;
export default class DataShareExtAbility extends DataShareExtensionAbility { export default class DataShareExtAbility extends DataShareExtensionAbility {
insert(uri, valueBucket, callback) { insert(uri, valueBucket, callback) {
if (valueBucket === null) { if (valueBucket === null) {
console.info('invalid valueBuckets'); console.error('invalid valueBuckets');
return; return;
} }
rdbStore.insert(TBL_NAME, valueBucket, function (err, ret) { rdbStore.insert(TBL_NAME, valueBucket, function (err, ret) {
console.info('callback ret:' + ret); console.info(`callback ret: ${ret}`);
if (callback !== undefined) { if (callback !== undefined) {
callback(err, ret); callback(err, ret);
} }
...@@ -256,7 +256,7 @@ export default class DataShareExtAbility extends DataShareExtensionAbility { ...@@ -256,7 +256,7 @@ export default class DataShareExtAbility extends DataShareExtensionAbility {
} }
rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) { rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) {
if (resultSet !== undefined) { if (resultSet !== undefined) {
console.info('resultSet.rowCount: ' + resultSet.rowCount); console.info(`resultSet.rowCount: ${resultSet.rowCount}`);
} }
if (callback !== undefined) { if (callback !== undefined) {
callback(err, resultSet); callback(err, resultSet);
...@@ -297,14 +297,12 @@ let rdbStore; ...@@ -297,14 +297,12 @@ let rdbStore;
export default class DataShareExtAbility extends DataShareExtensionAbility { export default class DataShareExtAbility extends DataShareExtensionAbility {
batchInsert(uri, valueBuckets, callback) { batchInsert(uri, valueBuckets, callback) {
if (valueBuckets === null || valueBuckets.length === undefined) { if (valueBuckets === null || valueBuckets.length === undefined) {
console.info('invalid valueBuckets'); console.error('invalid valueBuckets');
return; return;
} }
let resultNum = valueBuckets.length; rdbStore.batchInsert(TBL_NAME, valueBuckets, function (err, ret) {
valueBuckets.forEach(vb => {
rdbStore.insert(TBL_NAME, vb, function (err, ret) {
if (callback !== undefined) { if (callback !== undefined) {
callback(err, resultNum); callback(err, ret);
} }
}); });
}); });
...@@ -333,7 +331,7 @@ Normalizes a URI. This API can be overridden as required. ...@@ -333,7 +331,7 @@ Normalizes a URI. This API can be overridden as required.
export default class DataShareExtAbility extends DataShareExtensionAbility { export default class DataShareExtAbility extends DataShareExtensionAbility {
normalizeUri(uri, callback) { normalizeUri(uri, callback) {
let err = {'code':0}; let err = {'code':0};
let ret = 'normalize+' + uri; let ret = `normalize: ${uri}`;
callback(err, ret); callback(err, ret);
} }
}; };
...@@ -360,7 +358,7 @@ Denormalizes a URI. This API can be overridden as required. ...@@ -360,7 +358,7 @@ Denormalizes a URI. This API can be overridden as required.
export default class DataShareExtAbility extends DataShareExtensionAbility { export default class DataShareExtAbility extends DataShareExtensionAbility {
denormalizeUri(uri, callback) { denormalizeUri(uri, callback) {
let err = {'code':0}; let err = {'code':0};
let ret = 'denormalize+' + uri; let ret = `denormalize ${uri}`;
callback(err, ret); callback(err, ret);
} }
}; };
......
...@@ -27,7 +27,7 @@ let dataShareHelper; ...@@ -27,7 +27,7 @@ let dataShareHelper;
let uri = ("datashare:///com.samples.datasharetest.DataShare"); let uri = ("datashare:///com.samples.datasharetest.DataShare");
await dataShare.createDataShareHelper(this.context, uri, (err, data) => { await dataShare.createDataShareHelper(this.context, uri, (err, data) => {
if (err != undefined) { if (err != undefined) {
console.info("createDataShareHelper fail, error message : " + err); console.error("createDataShareHelper fail, error message : " + err);
} else { } else {
console.info("createDataShareHelper end, data : " + data); console.info("createDataShareHelper end, data : " + data);
dataShareHelper = data; dataShareHelper = data;
...@@ -39,10 +39,10 @@ let da = new dataSharePredicates.DataSharePredicates(); ...@@ -39,10 +39,10 @@ let da = new dataSharePredicates.DataSharePredicates();
let resultSet; let resultSet;
da.equalTo("name", "ZhangSan"); da.equalTo("name", "ZhangSan");
dataShareHelper.query(uri, da, columns).then((data) => { dataShareHelper.query(uri, da, columns).then((data) => {
console.log("query end, data : " + data); console.info("query end, data : " + data);
resultSet = data; resultSet = data;
}).catch((err) => { }).catch((err) => {
console.log("query fail, error message : " + err); console.error("query fail, error message : " + err);
}); });
``` ```
......
...@@ -7,10 +7,8 @@ The **DataShare** module allows an application to manage its own data and share ...@@ -7,10 +7,8 @@ The **DataShare** module allows an application to manage its own data and share
> - 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 and can be used only in the stage model.
> >
>
> - The APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
...@@ -51,7 +49,7 @@ Creates a **DataShareHelper** instance. This API uses an asynchronous callback t ...@@ -51,7 +49,7 @@ Creates a **DataShareHelper** instance. This API uses an asynchronous callback t
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| context | [Context](js-apis-app-ability-uiAbility.md) | Yes | Context of an application. | | context | [Context](js-apis-app-ability-uiAbility.md) | Yes | Context of the application. |
| uri | string | Yes | Uniform Resource Identifier (URI) of the server application to connect. | | uri | string | Yes | Uniform Resource Identifier (URI) of the server application to connect. |
| callback | AsyncCallback&lt;[DataShareHelper](#datasharehelper)&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the **DataShareHelper** instance created. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;[DataShareHelper](#datasharehelper)&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the **DataShareHelper** instance created. Otherwise, **err** is an error object.|
...@@ -72,7 +70,7 @@ let uri = ("datashare:///com.samples.datasharetest.DataShare"); ...@@ -72,7 +70,7 @@ let uri = ("datashare:///com.samples.datasharetest.DataShare");
let dataShareHelper; let dataShareHelper;
try { try {
dataShare.createDataShareHelper(this.context, uri, (err, data) => { dataShare.createDataShareHelper(this.context, uri, (err, data) => {
if (err != undefined) { if (err !== undefined) {
console.error(`createDataShareHelper error: code: ${err.code}, message: ${err.message} `); console.error(`createDataShareHelper error: code: ${err.code}, message: ${err.message} `);
return; return;
} }
...@@ -96,7 +94,7 @@ Creates a **DataShareHelper** instance. This API uses a promise to return the re ...@@ -96,7 +94,7 @@ Creates a **DataShareHelper** instance. This API uses a promise to return the re
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------------------------------------------------- | ---- | ------------------------------ | | ------- | ------------------------------------------------- | ---- | ------------------------------ |
| context | [Context](js-apis-app-ability-uiAbility.md) | Yes | Context of an application. | | context | [Context](js-apis-app-ability-uiAbility.md) | Yes | Context of the application. |
| uri | string | Yes | URI of the server application to connect.| | uri | string | Yes | URI of the server application to connect.|
**Return value** **Return value**
...@@ -262,7 +260,7 @@ const valueBucket = { ...@@ -262,7 +260,7 @@ const valueBucket = {
} }
try { try {
dataShareHelper.insert(uri, valueBucket).then((data) => { dataShareHelper.insert(uri, valueBucket).then((data) => {
console.log("insert succeed, data : " + data); console.info("insert succeed, data : " + data);
}). catch((err) => { }). catch((err) => {
console.error(`insert error: code: ${err.code}, message: ${err.message} `); console.error(`insert error: code: ${err.code}, message: ${err.message} `);
}); });
...@@ -298,7 +296,7 @@ let da = new dataSharePredicates.DataSharePredicates(); ...@@ -298,7 +296,7 @@ let da = new dataSharePredicates.DataSharePredicates();
da.equalTo("name", "ZhangSan"); da.equalTo("name", "ZhangSan");
try { try {
dataShareHelper.delete(uri, da, (err, data) => { dataShareHelper.delete(uri, da, (err, data) => {
if (err != undefined) { if (err !== undefined) {
console.error(`delete error: code: ${err.code}, message: ${err.message} `); console.error(`delete error: code: ${err.code}, message: ${err.message} `);
return; return;
} }
...@@ -341,7 +339,7 @@ let da = new dataSharePredicates.DataSharePredicates(); ...@@ -341,7 +339,7 @@ let da = new dataSharePredicates.DataSharePredicates();
da.equalTo("name", "ZhangSan"); da.equalTo("name", "ZhangSan");
try { try {
dataShareHelper.delete(uri, da).then((data) => { dataShareHelper.delete(uri, da).then((data) => {
console.log("delete succeed, data : " + data); console.info("delete succeed, data : " + data);
}). catch((err) => { }). catch((err) => {
console.error(`delete error: code: ${err.code}, message: ${err.message} `); console.error(`delete error: code: ${err.code}, message: ${err.message} `);
}); });
...@@ -379,11 +377,11 @@ let da = new dataSharePredicates.DataSharePredicates(); ...@@ -379,11 +377,11 @@ let da = new dataSharePredicates.DataSharePredicates();
da.equalTo("name", "ZhangSan"); da.equalTo("name", "ZhangSan");
try { try {
dataShareHelper.query(uri, da, columns, (err, data) => { dataShareHelper.query(uri, da, columns, (err, data) => {
if (err != undefined) { if (err !== undefined) {
console.error(`query error: code: ${err.code}, message: ${err.message} `); console.error(`query error: code: ${err.code}, message: ${err.message} `);
return; return;
} }
console.log("query succeed, rowCount : " + data.rowCount); console.info("query succeed, rowCount : " + data.rowCount);
}); });
} catch (err) { } catch (err) {
console.error(`query error: code: ${err.code}, message: ${err.message} `); console.error(`query error: code: ${err.code}, message: ${err.message} `);
...@@ -424,7 +422,7 @@ let da = new dataSharePredicates.DataSharePredicates(); ...@@ -424,7 +422,7 @@ let da = new dataSharePredicates.DataSharePredicates();
da.equalTo("name", "ZhangSan"); da.equalTo("name", "ZhangSan");
try { try {
dataShareHelper.query(uri, da, columns).then((data) => { dataShareHelper.query(uri, da, columns).then((data) => {
console.log("query succeed, rowCount : " + data.rowCount); console.info("query succeed, rowCount : " + data.rowCount);
}). catch((err) => { }). catch((err) => {
console.error(`query error: code: ${err.code}, message: ${err.message} `); console.error(`query error: code: ${err.code}, message: ${err.message} `);
}); });
...@@ -467,11 +465,11 @@ const va = { ...@@ -467,11 +465,11 @@ const va = {
} }
try { try {
dataShareHelper.update(uri, da, va, (err, data) => { dataShareHelper.update(uri, da, va, (err, data) => {
if (err != undefined) { if (err !== undefined) {
console.error(`update error: code: ${err.code}, message: ${err.message} `); console.error(`update error: code: ${err.code}, message: ${err.message} `);
return; return;
} }
console.log("update succeed, data : " + data); console.info("update succeed, data : " + data);
}); });
} catch (err) { } catch (err) {
console.error(`update error: code: ${err.code}, message: ${err.message} `); console.error(`update error: code: ${err.code}, message: ${err.message} `);
...@@ -517,7 +515,7 @@ const va = { ...@@ -517,7 +515,7 @@ const va = {
} }
try { try {
dataShareHelper.update(uri, da, va).then((data) => { dataShareHelper.update(uri, da, va).then((data) => {
console.log("update succeed, data : " + data); console.info("update succeed, data : " + data);
}). catch((err) => { }). catch((err) => {
console.error(`update error: code: ${err.code}, message: ${err.message} `); console.error(`update error: code: ${err.code}, message: ${err.message} `);
}); });
...@@ -552,11 +550,11 @@ let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,}, ...@@ -552,11 +550,11 @@ let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,},
{"name": "roe13", "age": 21, "salary": 20.5,}) {"name": "roe13", "age": 21, "salary": 20.5,})
try { try {
dataShareHelper.batchInsert(uri, vbs, (err, data) => { dataShareHelper.batchInsert(uri, vbs, (err, data) => {
if (err != undefined) { if (err !== undefined) {
console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `); console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `);
return; return;
} }
console.log("batchInsert succeed, data : " + data); console.info("batchInsert succeed, data : " + data);
}); });
} catch (err) { } catch (err) {
console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `); console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `);
...@@ -594,7 +592,7 @@ let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,}, ...@@ -594,7 +592,7 @@ let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,},
{"name": "roe13", "age": 21, "salary": 20.5,}) {"name": "roe13", "age": 21, "salary": 20.5,})
try { try {
dataShareHelper.batchInsert(uri, vbs).then((data) => { dataShareHelper.batchInsert(uri, vbs).then((data) => {
console.log("batchInsert succeed, data : " + data); console.info("batchInsert succeed, data : " + data);
}). catch((err) => { }). catch((err) => {
console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `); console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `);
}); });
...@@ -624,10 +622,10 @@ Normalizes a **DataShare** URI. The **DataShare** URI can be used only by the lo ...@@ -624,10 +622,10 @@ Normalizes a **DataShare** URI. The **DataShare** URI can be used only by the lo
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare"); let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.normalizeUri(uri, (err, data) => { dataShareHelper.normalizeUri(uri, (err, data) => {
if (err != undefined) { if (err !== undefined) {
console.log("normalizeUri failed, error message : " + err); console.error("normalizeUri failed, error message : " + err);
}else{ }else{
console.log("normalizeUri = " + data); console.info("normalizeUri = " + data);
} }
}); });
``` ```
...@@ -658,9 +656,9 @@ Normalizes a **DataShare** URI. The **DataShare** URI can be used only by the lo ...@@ -658,9 +656,9 @@ Normalizes a **DataShare** URI. The **DataShare** URI can be used only by the lo
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare"); let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.normalizeUri(uri).then((data) => { dataShareHelper.normalizeUri(uri).then((data) => {
console.log("normalizeUri = " + data); console.info("normalizeUri = " + data);
}).catch((err) => { }).catch((err) => {
console.log("normalizeUri failed, error message : " + err); console.error("normalizeUri failed, error message : " + err);
}); });
``` ```
...@@ -685,10 +683,10 @@ Denormalizes a URI. This API uses an asynchronous callback to return the result. ...@@ -685,10 +683,10 @@ Denormalizes a URI. This API uses an asynchronous callback to return the result.
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare"); let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.denormalizeUri(uri, (err, data) => { dataShareHelper.denormalizeUri(uri, (err, data) => {
if (err != undefined) { if (err !== undefined) {
console.log("denormalizeUri failed, error message : " + err); console.error("denormalizeUri failed, error message : " + err);
}else{ }else{
console.log("denormalizeUri = " + data); console.info("denormalizeUri = " + data);
} }
}); });
``` ```
...@@ -719,9 +717,9 @@ Denormalizes a URI. This API uses a promise to return the result. ...@@ -719,9 +717,9 @@ Denormalizes a URI. This API uses a promise to return the result.
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare"); let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.denormalizeUri(uri).then((data) => { dataShareHelper.denormalizeUri(uri).then((data) => {
console.log("denormalizeUri = " + data); console.info("denormalizeUri = " + data);
}).catch((err) => { }).catch((err) => {
console.log("denormalizeUri failed, error message : " + err); console.error("denormalizeUri failed, error message : " + err);
}); });
``` ```
...@@ -746,7 +744,7 @@ Notifies the registered observer of data changes. This API uses an asynchronous ...@@ -746,7 +744,7 @@ Notifies the registered observer of data changes. This API uses an asynchronous
import UIAbility from '@ohos.app.ability.UIAbility' import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare"); let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.notifyChange(uri, () => { dataShareHelper.notifyChange(uri, () => {
console.log("***** notifyChange *****"); console.info("***** notifyChange *****");
}); });
``` ```
......
...@@ -39,10 +39,10 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul ...@@ -39,10 +39,10 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ----------------------------------------------------------- | | ------------ | ------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. | | 14800010 | Failed to open or delete database by invalid database path. |
| 14800011 | Failed to open database by database corrupted. | | 14800011 | Failed open database, database corrupted. |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -123,10 +123,10 @@ Obtains an RDB store. This API uses a promise to return the result. You can set ...@@ -123,10 +123,10 @@ Obtains an RDB store. This API uses a promise to return the result. You can set
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ----------------------------------------------------------- | | ------------ | ------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. | | 14800010 | Failed to open or delete database by invalid database path. |
| 14800011 | Failed to open database by database corrupted. | | 14800011 | Failed open database, database corrupted. |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -199,9 +199,9 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul ...@@ -199,9 +199,9 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ----------------------------------------------------------- | | ------------ | ------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. | | 14800010 | Failed to open or delete database by invalid database path. |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -266,9 +266,9 @@ Deletes an RDB store. This API uses a promise to return the result. ...@@ -266,9 +266,9 @@ Deletes an RDB store. This API uses a promise to return the result.
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ----------------------------------------------------------- | | ------------ | ------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. | | 14800010 | Failed to open or delete database by invalid database path. |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -378,22 +378,6 @@ Defines the subscription type. ...@@ -378,22 +378,6 @@ Defines the subscription type.
| Name | Value | Description | | Name | Value | Description |
| --------------------- | ---- | ------------------ | | --------------------- | ---- | ------------------ |
| SUBSCRIBE_TYPE_REMOTE | 0 | Subscribe to remote data changes.| | SUBSCRIBE_TYPE_REMOTE | 0 | Subscribe to remote data changes.|
| SUBSCRIBE_TYPE_CLOUD<sup>10+</sup> | 1 | Subscribe to cloud data changes.|
## ConflictResolution<sup>10+</sup>
Defines the resolution to use when **insert()** and **update()** conflict.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name | Value | Description |
| -------------------- | ---- | ------------------------------------------------------------ |
| ON_CONFLICT_NONE | 0 | No operation is performed.|
| ON_CONFLICT_ROLLBACK | 1 | Abort the SQL statement and roll back the current transaction. |
| ON_CONFLICT_ABORT | 2 | Abort the current SQL statement and revert any changes made by the current SQL statement. However, the changes made by the previous SQL statement in the same transaction are retained and the transaction remains active.|
| ON_CONFLICT_FAIL | 3 | Abort the current SQL statement. The **FAIL** resolution does not revert previous changes made by the failed SQL statement or end the transaction.|
| ON_CONFLICT_IGNORE | 4 | Skip the rows that contain constraint violations and continue to process the subsequent rows of the SQL statement.|
| ON_CONFLICT_REPLACE | 5 | Delete pre-existing rows that cause the constraint violation before inserting or updating the current row, and continue to execute the command normally.|
## RdbPredicates ## RdbPredicates
...@@ -1257,23 +1241,6 @@ Provides APIs to manage an RDB store. ...@@ -1257,23 +1241,6 @@ Provides APIs to manage an RDB store.
Before using the APIs of this class, use [executeSql](#executesql) to initialize the database table structure and related data. Before using the APIs of this class, use [executeSql](#executesql) to initialize the database table structure and related data.
### Attributes<sup>10+</sup>
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name | Type | Mandatory| Description |
| ------------ | ----------- | ---- | -------------------------------- |
| version<sup>10+</sup> | number | Yes | RDB store version, which is an integer greater than 0. |
**Example**
```js
// Set the RDB store version.
store.version = 3;
// Obtain the RDB store version.
console.info(`RdbStore version is ${store.version}`);
```
### insert ### insert
insert(table: string, values: ValuesBucket, callback: AsyncCallback&lt;number&gt;):void insert(table: string, values: ValuesBucket, callback: AsyncCallback&lt;number&gt;):void
...@@ -1290,15 +1257,6 @@ Inserts a row of data into a table. This API uses an asynchronous callback to re ...@@ -1290,15 +1257,6 @@ Inserts a row of data into a table. This API uses an asynchronous callback to re
| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. | | values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
```js ```js
...@@ -1317,49 +1275,6 @@ store.insert("EMPLOYEE", valueBucket, function (err, rowId) { ...@@ -1317,49 +1275,6 @@ store.insert("EMPLOYEE", valueBucket, function (err, rowId) {
}) })
``` ```
### insert<sup>10+</sup>
insert(table: string, values: ValuesBucket, conflict: ConflictResolution, callback: AsyncCallback&lt;number&gt;):void
Inserts a row of data into a table. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | ---------------------------------------------------------- |
| table | string | Yes | Name of the target table. |
| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. |
| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example**
```js
const valueBucket = {
"NAME": "Lisa",
"AGE": 18,
"SALARY": 100.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
};
store.insert("EMPLOYEE", valueBucket, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE, function (err, rowId) {
if (err) {
console.error(`Insert is failed, code is ${err.code},message is ${err.message}`);
return;
}
console.info(`Insert is successful, rowId = ${rowId}`);
})
```
### insert ### insert
...@@ -1388,8 +1303,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1388,8 +1303,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1408,53 +1322,6 @@ promise.then((rowId) => { ...@@ -1408,53 +1322,6 @@ promise.then((rowId) => {
}) })
``` ```
### insert<sup>10+</sup>
insert(table: string, values: ValuesBucket, conflict: ConflictResolution):Promise&lt;number&gt;
Inserts a row of data into a table. This API uses a promise to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | -------------------------- |
| table | string | Yes | Name of the target table. |
| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert.|
| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------- |
| Promise&lt;number&gt; | Promise used to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example**
```js
const valueBucket = {
"NAME": "Lisa",
"AGE": 18,
"SALARY": 100.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
};
let promise = store.insert("EMPLOYEE", valueBucket, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE);
promise.then((rowId) => {
console.info(`Insert is successful, rowId = ${rowId}`);
}).catch((err) => {
console.error(`Insert is failed, code is ${err.code},message is ${err.message}`);
})
```
### batchInsert ### batchInsert
...@@ -1478,8 +1345,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1478,8 +1345,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1540,8 +1406,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1540,8 +1406,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1590,14 +1455,14 @@ Updates data in the RDB store based on the specified **RdbPredicates** object. T ...@@ -1590,14 +1455,14 @@ Updates data in the RDB store based on the specified **RdbPredicates** object. T
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. | | predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of rows updated. | | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of rows updated. |
**Error codes** **Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1619,51 +1484,6 @@ store.update(valueBucket, predicates, function (err, rows) { ...@@ -1619,51 +1484,6 @@ store.update(valueBucket, predicates, function (err, rows) {
}) })
``` ```
### update<sup>10+</sup>
update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution, callback: AsyncCallback&lt;number&gt;):void
Updates data in the RDB store based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. |
| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of rows updated. |
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example**
```js
const valueBucket = {
"NAME": "Rose",
"AGE": 22,
"SALARY": 200.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
};
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.equalTo("NAME", "Lisa");
store.update(valueBucket, predicates, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE, function (err, rows) {
if (err) {
console.error(`Updated failed, code is ${err.code},message is ${err.message}`);
return;
}
console.info(`Updated row count: ${rows}`);
})
```
### update ### update
...@@ -1692,8 +1512,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1692,8 +1512,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1714,55 +1533,6 @@ promise.then(async (rows) => { ...@@ -1714,55 +1533,6 @@ promise.then(async (rows) => {
}) })
``` ```
### update<sup>10+</sup>
update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution):Promise&lt;number&gt;
Updates data based on the specified **RdbPredicates** object. This API uses a promise to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. |
| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
**Return value**
| Type | Description |
| --------------------- | ----------------------------------------- |
| Promise&lt;number&gt; | Promise used to return the number of rows updated.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example**
```js
const valueBucket = {
"NAME": "Rose",
"AGE": 22,
"SALARY": 200.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
};
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.equalTo("NAME", "Lisa");
let promise = store.update(valueBucket, predicates, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE);
promise.then(async (rows) => {
console.info(`Updated row count: ${rows}`);
}).catch((err) => {
console.error(`Updated failed, code is ${err.code},message is ${err.message}`);
})
```
### update ### update
...@@ -1791,8 +1561,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1791,8 +1561,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1847,8 +1616,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1847,8 +1616,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1891,8 +1659,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1891,8 +1659,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1934,8 +1701,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1934,8 +1701,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1976,8 +1742,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1976,8 +1742,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -2025,8 +1790,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -2025,8 +1790,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -2063,8 +1827,8 @@ Queries data from the RDB store based on specified conditions. This API uses an ...@@ -2063,8 +1827,8 @@ Queries data from the RDB store based on specified conditions. This API uses an
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2076,17 +1840,8 @@ store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err, ...@@ -2076,17 +1840,8 @@ store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err,
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
return; return;
} }
console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); console.info(`ResultSet column names: ${resultSet.columnNames}`);
// resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. console.info(`ResultSet column count: ${resultSet.columnCount}`);
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}) })
``` ```
...@@ -2105,20 +1860,20 @@ Queries data from the RDB store based on specified conditions. This API uses a p ...@@ -2105,20 +1860,20 @@ Queries data from the RDB store based on specified conditions. This API uses a p
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. | | predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. |
| columns | Array&lt;string&gt; | No | Columns to query. If this parameter is not specified, the query applies to all columns.| | columns | Array&lt;string&gt; | No | Columns to query. If this parameter is not specified, the query applies to all columns.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | ---------------------------- |
| 14800000 | Inner error. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------------- | -------------------------------------------------- | | ------------------------------------------------------- | -------------------------------------------------- |
| Promise&lt;[ResultSet](#resultset)&gt; | Promise used to return the result. If the operation is successful, a **ResultSet** object will be returned.| | Promise&lt;[ResultSet](#resultset)&gt; | Promise used to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. |
**Example** **Example**
```js ```js
...@@ -2126,17 +1881,8 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); ...@@ -2126,17 +1881,8 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.equalTo("NAME", "Rose"); predicates.equalTo("NAME", "Rose");
let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => { promise.then((resultSet) => {
console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); console.info(`ResultSet column names: ${resultSet.columnNames}`);
// resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. console.info(`ResultSet column count: ${resultSet.columnCount}`);
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}).catch((err) => { }).catch((err) => {
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
}) })
...@@ -2168,8 +1914,8 @@ Queries data from the RDB store based on specified conditions. This API uses an ...@@ -2168,8 +1914,8 @@ Queries data from the RDB store based on specified conditions. This API uses an
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2182,17 +1928,8 @@ store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], fu ...@@ -2182,17 +1928,8 @@ store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], fu
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
return; return;
} }
console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); console.info(`ResultSet column names: ${resultSet.columnNames}`);
// resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. console.info(`ResultSet column count: ${resultSet.columnCount}`);
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}) })
``` ```
...@@ -2227,8 +1964,8 @@ Queries data from the RDB store based on specified conditions. This API uses a p ...@@ -2227,8 +1964,8 @@ Queries data from the RDB store based on specified conditions. This API uses a p
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2238,17 +1975,8 @@ let predicates = new dataSharePredicates.DataSharePredicates(); ...@@ -2238,17 +1975,8 @@ let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo("NAME", "Rose"); predicates.equalTo("NAME", "Rose");
let promise = store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); let promise = store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => { promise.then((resultSet) => {
console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); console.info(`ResultSet column names: ${resultSet.columnNames}`);
// resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. console.info(`ResultSet column count: ${resultSet.columnCount}`);
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}).catch((err) => { }).catch((err) => {
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
}) })
...@@ -2281,8 +2009,8 @@ Queries data from the RDB store of a remote device based on specified conditions ...@@ -2281,8 +2009,8 @@ Queries data from the RDB store of a remote device based on specified conditions
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2309,17 +2037,8 @@ store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALAR ...@@ -2309,17 +2037,8 @@ store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALAR
console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`); console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`);
return; return;
} }
console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); console.info(`ResultSet column names: ${resultSet.columnNames}`);
// resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. console.info(`ResultSet column count: ${resultSet.columnCount}`);
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
} }
) )
``` ```
...@@ -2356,8 +2075,8 @@ Queries data from the RDB store of a remote device based on specified conditions ...@@ -2356,8 +2075,8 @@ Queries data from the RDB store of a remote device based on specified conditions
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2380,17 +2099,8 @@ let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); ...@@ -2380,17 +2099,8 @@ let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.greaterThan("id", 0); predicates.greaterThan("id", 0);
let promise = store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); let promise = store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => { promise.then((resultSet) => {
console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); console.info(`ResultSet column names: ${resultSet.columnNames}`);
// resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. console.info(`ResultSet column count: ${resultSet.columnCount}`);
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}).catch((err) => { }).catch((err) => {
console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`); console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`);
}) })
...@@ -2417,8 +2127,8 @@ Queries data using the specified SQL statement. This API uses an asynchronous ca ...@@ -2417,8 +2127,8 @@ Queries data using the specified SQL statement. This API uses an asynchronous ca
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2428,17 +2138,8 @@ store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['s ...@@ -2428,17 +2138,8 @@ store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['s
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
return; return;
} }
console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); console.info(`ResultSet column names: ${resultSet.columnNames}`);
// resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. console.info(`ResultSet column count: ${resultSet.columnCount}`);
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}) })
``` ```
...@@ -2468,25 +2169,16 @@ Queries data using the specified SQL statement. This API uses a promise to retur ...@@ -2468,25 +2169,16 @@ Queries data using the specified SQL statement. This API uses a promise to retur
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
```js ```js
let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'"); let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'");
promise.then((resultSet) => { promise.then((resultSet) => {
console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); console.info(`ResultSet column names: ${resultSet.columnNames}`);
// resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. console.info(`ResultSet column count: ${resultSet.columnCount}`);
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}).catch((err) => { }).catch((err) => {
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
}) })
...@@ -2514,8 +2206,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -2514,8 +2206,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -2557,8 +2248,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -2557,8 +2248,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -2586,8 +2276,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -2586,8 +2276,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. | | 14800000 | The inner error is occurred. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -2709,8 +2398,8 @@ Backs up an RDB store. This API uses an asynchronous callback to return the resu ...@@ -2709,8 +2398,8 @@ Backs up an RDB store. This API uses an asynchronous callback to return the resu
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2738,19 +2427,19 @@ Backs up an RDB store. This API uses a promise to return the result. ...@@ -2738,19 +2427,19 @@ Backs up an RDB store. This API uses a promise to return the result.
| -------- | ------ | ---- | ------------------------ | | -------- | ------ | ---- | ------------------------ |
| destName | string | Yes | Name of the RDB store backup file.| | destName | string | Yes | Name of the RDB store backup file.|
**Return value**
| Type | Description |
| ------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.|
**Error codes** **Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Return value**
| Type | Description |
| ------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -2783,8 +2472,8 @@ Restores an RDB store from a backup file. This API uses an asynchronous callback ...@@ -2783,8 +2472,8 @@ Restores an RDB store from a backup file. This API uses an asynchronous callback
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2823,8 +2512,8 @@ Restores an RDB store from a backup file. This API uses a promise to return the ...@@ -2823,8 +2512,8 @@ Restores an RDB store from a backup file. This API uses a promise to return the
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2859,8 +2548,8 @@ Sets distributed tables. This API uses an asynchronous callback to return the re ...@@ -2859,8 +2548,8 @@ Sets distributed tables. This API uses an asynchronous callback to return the re
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2901,8 +2590,8 @@ Sets distributed tables. This API uses a promise to return the result. ...@@ -2901,8 +2590,8 @@ Sets distributed tables. This API uses a promise to return the result.
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2921,7 +2610,7 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac ...@@ -2921,7 +2610,7 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac
Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried. Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried.
> **NOTE** > **NOTE**<br/>
> >
> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. > The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
...@@ -2942,8 +2631,8 @@ Obtains the distributed table name of a remote device based on the local table n ...@@ -2942,8 +2631,8 @@ Obtains the distributed table name of a remote device based on the local table n
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -2977,7 +2666,7 @@ store.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) ...@@ -2977,7 +2666,7 @@ store.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName)
Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried. Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried.
> **NOTE** > **NOTE**<br/>
> >
> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. > The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
...@@ -3003,8 +2692,8 @@ Obtains the distributed table name of a remote device based on the local table n ...@@ -3003,8 +2692,8 @@ Obtains the distributed table name of a remote device based on the local table n
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -3054,8 +2743,8 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret ...@@ -3054,8 +2743,8 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -3118,8 +2807,8 @@ Synchronizes data between devices. This API uses a promise to return the result. ...@@ -3118,8 +2807,8 @@ Synchronizes data between devices. This API uses a promise to return the result.
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ---------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | Inner error. | | 14800000 | The inner error is occurred. |
**Example** **Example**
...@@ -3188,7 +2877,7 @@ try { ...@@ -3188,7 +2877,7 @@ try {
off(event:'dataChange', type: SubscribeType, observer: Callback&lt;Array&lt;string&gt;&gt;): void off(event:'dataChange', type: SubscribeType, observer: Callback&lt;Array&lt;string&gt;&gt;): void
Unregisters the observer of the specified type from the RDB store. This API uses a callback to return the result. Unregisters the observer of the specified type.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
......
...@@ -8,8 +8,6 @@ The **DataStorage** module provides applications with data processing capability ...@@ -8,8 +8,6 @@ The **DataStorage** module provides applications with data processing capability
> - The initial APIs of this module are supported since API version 6. 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 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> >
> - The APIs of this module are no longer maintained since API version 9. You are advised to use [@ohos.data.preferences](js-apis-data-preferences.md). > - The APIs of this module are no longer maintained since API version 9. You are advised to use [@ohos.data.preferences](js-apis-data-preferences.md).
>
> - The APIs of this module can be used only in the FA model.
## Modules to Import ## Modules to Import
...@@ -230,7 +228,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete ...@@ -230,7 +228,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
| Type | Description | | Type | Description |
| ------------------- | ------------------------------- | | ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. | | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -337,7 +335,7 @@ Removes the singleton **Storage** instance of a file from the cache. The removed ...@@ -337,7 +335,7 @@ Removes the singleton **Storage** instance of a file from the cache. The removed
| Type | Description | | Type | Description |
| ------------------- | ------------------------------- | | ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. | | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -524,7 +522,7 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat ...@@ -524,7 +522,7 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat
| Type | Description | | Type | Description |
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. | | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -705,7 +703,7 @@ Deletes data with the specified key from this storage object. This API uses a pr ...@@ -705,7 +703,7 @@ Deletes data with the specified key from this storage object. This API uses a pr
| Type | Description | | Type | Description |
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. | | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -746,7 +744,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz ...@@ -746,7 +744,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- | | -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value.|
**Example** **Example**
...@@ -773,7 +771,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz ...@@ -773,7 +771,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz
| Type | Description | | Type | Description |
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. | | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -814,7 +812,7 @@ Clears this **Storage** object. This API uses an asynchronous callback to return ...@@ -814,7 +812,7 @@ Clears this **Storage** object. This API uses an asynchronous callback to return
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- | | -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value.|
**Example** **Example**
...@@ -840,7 +838,7 @@ Clears this **Storage** object. This API uses a promise to return the result. ...@@ -840,7 +838,7 @@ Clears this **Storage** object. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. | | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
......
...@@ -36,10 +36,10 @@ Describes a rectangle on the display. ...@@ -36,10 +36,10 @@ Describes a rectangle on the display.
| Name | Type| Readable| Writable| Description | | Name | Type| Readable| Writable| Description |
| ------ | -------- | ---- | ---- | ------------------ | | ------ | -------- | ---- | ---- | ------------------ |
| left | number | Yes | Yes | Left boundary of the rectangle, in pixels.| | left | number | Yes | Yes | Left boundary of the rectangle, in pixels. The value must be an integer.|
| top | number | Yes | Yes | Top boundary of the rectangle, in pixels.| | top | number | Yes | Yes | Top boundary of the rectangle, in pixels. The value must be an integer.|
| width | number | Yes | Yes | Width of the rectangle, in pixels. | | width | number | Yes | Yes | Width of the rectangle, in pixels. The value must be an integer. |
| height | number | Yes | Yes | Height of the rectangle, in pixels. | | height | number | Yes | Yes | Height of the rectangle, in pixels. The value must be an integer. |
## WaterfallDisplayAreaRects<sup>9+</sup> ## WaterfallDisplayAreaRects<sup>9+</sup>
...@@ -183,7 +183,7 @@ Checks whether there is a visible privacy window on a display. The privacy windo ...@@ -183,7 +183,7 @@ Checks whether there is a visible privacy window on a display. The privacy windo
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- |----------| | ------ | ------------------------- | ---- |----------|
| id | number | Yes | ID of the display.| | id | number | Yes | ID of the display. The value must be an integer.|
**Return value** **Return value**
...@@ -235,10 +235,10 @@ Subscribes to display changes. ...@@ -235,10 +235,10 @@ Subscribes to display changes.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- |---------------------------------------------------------------------------------------------------------------------------------|
| type | string | Yes| Event type.<br>- **add**, indicating the display addition event. Example: event that a display is connected.<br>- **remove**, indicating the display removal event. Example: event that a display is disconnected.<br>- **change**, indicating the display change event. Example: event that the display orientation is changed.| | type | string | Yes| Event type.<br>- **add**, indicating the display addition event. Example: event that a display is connected.<br>- **remove**, indicating the display removal event. Example: event that a display is disconnected.<br>- **change**, indicating the display change event. Example: event that the display orientation is changed.|
| callback | Callback&lt;number&gt; | Yes| Callback used to return the ID of the display.| | callback | Callback&lt;number&gt; | Yes| Callback used to return the ID of the display, which is an integer. |
**Example** **Example**
...@@ -266,7 +266,7 @@ Unsubscribes from display changes. ...@@ -266,7 +266,7 @@ Unsubscribes from display changes.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type.<br>- **add**, indicating the display addition event. Example: event that a display is connected.<br>- **remove**, indicating the display removal event. Example: event that a display is disconnected.<br>- **change**, indicating the display change event. Example: event that the display orientation is changed.| | type | string | Yes| Event type.<br>- **add**, indicating the display addition event. Example: event that a display is connected.<br>- **remove**, indicating the display removal event. Example: event that a display is disconnected.<br>- **change**, indicating the display change event. Example: event that the display orientation is changed.|
| callback | Callback&lt;number&gt; | No| Callback used to return the ID of the display.| | callback | Callback&lt;number&gt; | No| Callback used to return the ID of the display, which is an integer.|
**Example** **Example**
...@@ -409,21 +409,21 @@ Before calling any API in **Display**, you must use [getAllDisplays()](#displayg ...@@ -409,21 +409,21 @@ Before calling any API in **Display**, you must use [getAllDisplays()](#displayg
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |---------------------------------------------------------------------------------------------------------------|
| id | number | Yes| No| ID of the display.| | id | number | Yes| No| ID of the display. The value must be an integer. |
| name | string | Yes| No| Name of the display.| | name | string | Yes| No| Name of the display. |
| alive | boolean | Yes| No| Whether the display is alive.| | alive | boolean | Yes| No| Whether the display is alive. |
| state | [DisplayState](#displaystate) | Yes| No| State of the display.| | state | [DisplayState](#displaystate) | Yes| No| State of the display. |
| refreshRate | number | Yes| No| Refresh rate of the display.| | refreshRate | number | Yes| No| Refresh rate of the display. The value must be an integer. |
| rotation | number | Yes| No| Screen rotation angle of the display.<br>The value **0** indicates that the screen of the display rotates by 0°.<br>The value **1** indicates that the screen of the display rotates by 90°.<br>The value **2** indicates that the screen of the display rotates by 180°.<br>The value **3** indicates that the screen of the display rotates by 270°.| | rotation | number | Yes| No| Screen rotation angle of the display.<br>The value **0** indicates that the screen of the display rotates by 0°.<br>The value **1** indicates that the screen of the display rotates by 90°.<br>The value **2** indicates that the screen of the display rotates by 180°.<br>The value **3** indicates that the screen of the display rotates by 270°.|
| width | number | Yes| No| Width of the display, in pixels.| | width | number | Yes| No| Width of the display, in pixels. The value must be an integer. |
| height | number | Yes| No| Height of the display, in pixels.| | height | number | Yes| No| Height of the display, in pixels. The value must be an integer. |
| densityDPI | number | Yes| No| Screen density of the display, that is, the number of dots per inch. Generally, the value is **160** or **480**.| | densityDPI | number | Yes| No| Screen density of the display, that is, the number of dots per inch. The value must be a floating point number. Generally, the value is **160.0** or **480.0**. |
| densityPixels | number | Yes| No| Logical density of the display, which is a scaling coefficient independent of the pixel unit. Generally, the value is **1** or **3**.| | densityPixels | number | Yes| No| Logical density of the display, which is a scaling coefficient independent of the pixel unit. The value must be a floating point number. Generally, the value is **1.0** or **3.0**. |
| scaledDensity | number | Yes| No| Scaling factor for fonts displayed on the display. Generally, the value is the same as that of **densityPixels**.| | scaledDensity | number | Yes| No| Scaling factor for fonts displayed on the display. The value must be a floating point number. Generally, the value is the same as that of **densityPixels**. |
| xDPI | number | Yes| No| Exact physical dots per inch of the screen in the horizontal direction.| | xDPI | number | Yes| No| Exact physical dots per inch of the screen in the horizontal direction. The value must be a floating point number. |
| yDPI | number | Yes| No| Exact physical dots per inch of the screen in the vertical direction.| | yDPI | number | Yes| No| Exact physical dots per inch of the screen in the vertical direction. The value must be a floating point number. |
### getCutoutInfo<sup>9+</sup> ### getCutoutInfo<sup>9+</sup>
getCutoutInfo(callback: AsyncCallback&lt;CutoutInfo&gt;): void getCutoutInfo(callback: AsyncCallback&lt;CutoutInfo&gt;): void
......
...@@ -251,7 +251,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ...@@ -251,7 +251,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes
## fs.close ## fs.close
close(file: File|number): Promise&lt;void&gt; close(file: number|File): Promise&lt;void&gt;
Closes a file. This API uses a promise to return the result. Closes a file. This API uses a promise to return the result.
...@@ -261,7 +261,7 @@ Closes a file. This API uses a promise to return the result. ...@@ -261,7 +261,7 @@ Closes a file. This API uses a promise to return the result.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ | | ---- | ------ | ---- | ------------ |
| file | [File](#file)\|number | Yes | File object or FD of the file to close.| | file | number\|[File](#file) | Yes | File object or FD of the file to close.|
**Return value** **Return value**
...@@ -288,7 +288,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ...@@ -288,7 +288,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes
## fs.close ## fs.close
close(file: File|number, callback: AsyncCallback&lt;void&gt;): void close(file: number|File, callback: AsyncCallback&lt;void&gt;): void
Closes a file. This API uses an asynchronous callback to return the result. Closes a file. This API uses an asynchronous callback to return the result.
...@@ -298,7 +298,7 @@ Closes a file. This API uses an asynchronous callback to return the result. ...@@ -298,7 +298,7 @@ Closes a file. This API uses an asynchronous callback to return the result.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------ | | -------- | ------------------------- | ---- | ------------ |
| file | [File](#file)\|number | Yes | File object or FD of the file to close.| | file | number\|[File](#file) | Yes | File object or FD of the file to close.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked immediately after the file is closed.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked immediately after the file is closed.|
**Error codes** **Error codes**
...@@ -321,7 +321,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ...@@ -321,7 +321,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes
## fs.closeSync ## fs.closeSync
closeSync(file: File|number): void closeSync(file: number|File): void
Synchronously closes a file. Synchronously closes a file.
...@@ -331,7 +331,7 @@ Synchronously closes a file. ...@@ -331,7 +331,7 @@ Synchronously closes a file.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ | | ---- | ------ | ---- | ------------ |
| file | [File](#file)\|number | Yes | File object or FD of the file to close.| | file | number\|[File](#file) | Yes | File object or FD of the file to close.|
**Error codes** **Error codes**
...@@ -1239,7 +1239,7 @@ Synchronously reads the text of a file. ...@@ -1239,7 +1239,7 @@ Synchronously reads the text of a file.
| Type | Description | | Type | Description |
| ------ | -------------------- | | ------ | -------------------- |
| string | Promise used to return the content of the file read.| | string | Returns the content of the file read.|
**Error codes** **Error codes**
...@@ -1811,6 +1811,8 @@ listFile(path: string, options?: { ...@@ -1811,6 +1811,8 @@ listFile(path: string, options?: {
Lists all files in a directory. This API uses an asynchronous callback to return the result.<br>This API supports recursive listing of all files (including files in subdirectories) and file filtering. Lists all files in a directory. This API uses an asynchronous callback to return the result.<br>This API supports recursive listing of all files (including files in subdirectories) and file filtering.
**System capability**: SystemCapability.FileManagement.File.FileIO
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
...@@ -1866,6 +1868,8 @@ listFileSync(path: string, options?: { ...@@ -1866,6 +1868,8 @@ listFileSync(path: string, options?: {
Lists all files in a directory synchronously. This API supports recursive listing of all files (including files in subdirectories) and file filtering. Lists all files in a directory synchronously. This API supports recursive listing of all files (including files in subdirectories) and file filtering.
**System capability**: SystemCapability.FileManagement.File.FileIO
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
...@@ -1986,7 +1990,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ...@@ -1986,7 +1990,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes
## fs.moveFileSync ## fs.moveFileSync
moveFile(src: string, dest: string, mode?: number): void moveFileSync(src: string, dest: string, mode?: number): void
Moves a file synchronously. Moves a file synchronously.
...@@ -2933,7 +2937,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ...@@ -2933,7 +2937,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes
**Example** **Example**
```js ```js
let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let file = fs.openSync(pathDir + "/test.txt", fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
file.lock(true).then(() => { file.lock(true).then(() => {
console.log("lock file successful"); console.log("lock file successful");
}).catch((err) => { }).catch((err) => {
...@@ -2963,7 +2967,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ...@@ -2963,7 +2967,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes
**Example** **Example**
```js ```js
let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let file = fs.openSync(pathDir + "/test.txt", fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
file.lock(true, (err) => { file.lock(true, (err) => {
if (err) { if (err) {
console.info("lock file failed with error message: " + err.message + ", error code: " + err.code); console.info("lock file failed with error message: " + err.message + ", error code: " + err.code);
...@@ -2994,7 +2998,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ...@@ -2994,7 +2998,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes
**Example** **Example**
```js ```js
let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let file = fs.openSync(pathDir + "/test.txt", fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
file.tryLock(true); file.tryLock(true);
console.log("lock file successful"); console.log("lock file successful");
``` ```
...@@ -3014,7 +3018,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ...@@ -3014,7 +3018,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes
**Example** **Example**
```js ```js
let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let file = fs.openSync(pathDir + "/test.txt", fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
file.tryLock(true); file.tryLock(true);
file.unlock(); file.unlock();
console.log("unlock file successful"); console.log("unlock file successful");
......
...@@ -5,6 +5,7 @@ The **font** module provides APIs for registering custom fonts. ...@@ -5,6 +5,7 @@ The **font** module provides APIs for registering custom fonts.
> **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.
>
## Modules to Import ## Modules to Import
...@@ -28,12 +29,14 @@ Registers a custom font with the font manager. ...@@ -28,12 +29,14 @@ Registers a custom font with the font manager.
## FontOptions ## FontOptions
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ | | ---------- | ------ | ---- | ------------ |
| familyName | string | Yes | Name of the custom font to register. | | familyName | string | Yes | Name of the custom font to register. |
| familySrc | string | Yes | Path of the custom font to register.| | familySrc | string | Yes | Path of the custom font to register.|
## Example **Example**
```ts ```ts
// xxx.ets // xxx.ets
......
...@@ -471,7 +471,7 @@ Defines the parameters that need to be specified for bundle installation, uninst ...@@ -471,7 +471,7 @@ Defines the parameters that need to be specified for bundle installation, uninst
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------------------------------ | ------------------------------ | ------------------ | ------------------ | | ------------------------------ | ------------------------------ | ------------------ | ------------------ |
| userId | number | No | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user of the current process.| | userId | number | No | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user of the current process.|
| installFlag | number | No | Installation flag. The value **0** means initial installation and **1** means overwrite installation.| | installFlag | number | No | Installation flag. The value **0x00** means initial installation, **0x01** means overwrite installation, and **0x10** means installation-free. The default value is **0x00**.|
| isKeepData | boolean | No | Whether to retain the data directory during bundle uninstall.| | isKeepData | boolean | No | Whether to retain the data directory during bundle uninstall.|
| hashParams | Array<[HashParam](#hashparam)> | No| Hash parameters. | | hashParams | Array<[HashParam](#hashparam)> | No| Hash parameters. |
| crowdtestDeadline| number | No | End date of crowdtesting. The default value is **-1**, indicating that no end date is specified for crowdtesting.| | crowdtestDeadline| number | No | End date of crowdtesting. The default value is **-1**, indicating that no end date is specified for crowdtesting.|
...@@ -16,7 +16,7 @@ import matrix4 from '@ohos.matrix4' ...@@ -16,7 +16,7 @@ import matrix4 from '@ohos.matrix4'
## matrix4.init ## matrix4.init
init(array: Array&lt;number&gt;): Matrix4Transit init(options: [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number]): Matrix4Transit
Matrix constructor, which is used to create a 4 x 4 matrix by using the input parameter. Column-major order is used. Matrix constructor, which is used to create a 4 x 4 matrix by using the input parameter. Column-major order is used.
...@@ -26,16 +26,16 @@ Matrix constructor, which is used to create a 4 x 4 matrix by using the input pa ...@@ -26,16 +26,16 @@ Matrix constructor, which is used to create a 4 x 4 matrix by using the input pa
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------- | ---- | ------------------------------------------------------------ | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| array | Array&lt;number&gt; | Yes | A number array whose length is 16 (4 x 4). For details, see **array** parameters.<br>Default value:<br>[1, 0, 0, 0,<br>0, 1, 0, 0,<br>0, 0, 1, 0,<br>0, 0, 0, 1] | | option | [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number] | Yes | A number array whose length is 16 (4 x 4). For details, see **Description of a 4 x 4 matrix**.<br>Default value:<br>[1,&nbsp;0,&nbsp;0,&nbsp;0,<br>0,&nbsp;1,&nbsp;0,&nbsp;0,<br>0,&nbsp;0,&nbsp;1,&nbsp;0,<br>0,&nbsp;0,&nbsp;0,&nbsp;1] |
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------- | | --------------------------------- | ---------------------------- |
| Matrix4Transit | 4 x 4 matrix object created based on the input parameter.| | [Matrix4Transit](#matrix4transit) | 4 x 4 matrix object created based on the input parameter.|
**array** parameters **Description of a 4 x 4 matrix**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ------ | ---- | -------------------- | | ---- | ------ | ---- | -------------------- |
...@@ -92,8 +92,8 @@ Constructs an identity matrix. ...@@ -92,8 +92,8 @@ Constructs an identity matrix.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | -------------- | | --------------------------------- | -------------- |
| Matrix4Transit | Identity matrix object.| | [Matrix4Transit](#matrix4transit) | Identity matrix object.|
**Example** **Example**
...@@ -137,8 +137,8 @@ Copies this matrix object. ...@@ -137,8 +137,8 @@ Copies this matrix object.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | -------------------- | | --------------------------------- | -------------------- |
| Matrix4Transit | Copy object of the current matrix.| | [Matrix4Transit](#matrix4transit) | Copy object of the current matrix.|
**Example** **Example**
...@@ -171,12 +171,12 @@ struct Test { ...@@ -171,12 +171,12 @@ struct Test {
![en-us_image_0000001219744181](figures/en-us_image_0000001219744181.png) ![en-us_image_0000001219744181](figures/en-us_image_0000001219744181.png)
## Matrix4 ## Matrix4Transit
### combine ### combine
combine(matrix: Matrix4): Matrix4Transit combine(options: Matrix4Transit): Matrix4Transit
Combines the effects of two matrices to generate a new matrix object. Combines the effects of two matrices to generate a new matrix object.
...@@ -186,14 +186,14 @@ Combines the effects of two matrices to generate a new matrix object. ...@@ -186,14 +186,14 @@ Combines the effects of two matrices to generate a new matrix object.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------ | | ------ | --------------------------------- | ---- | ------------------ |
| matrix | Matrix4 | Yes | Matrix object to be combined.| | option | [Matrix4Transit](#matrix4transit) | Yes | Matrix object to be combined.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ------------------ | | --------------------------------- | ------------------ |
| Matrix4Transit | Object after matrix combination.| | [Matrix4Transit](#matrix4transit) | Object after matrix combination.|
**Example** **Example**
...@@ -239,8 +239,8 @@ Inverts this matrix object. ...@@ -239,8 +239,8 @@ Inverts this matrix object.
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------- | | --------------------------------- | ---------------------- |
| Matrix4Transit | Inverse matrix object of the current matrix.| | [Matrix4Transit](#matrix4transit) | Inverse matrix object of the current matrix.|
**Example** **Example**
...@@ -273,7 +273,7 @@ struct Tests { ...@@ -273,7 +273,7 @@ struct Tests {
### translate ### translate
translate({x?: number, y?: number, z?: number}): Matrix4Transit translate(options: TranslateOption): Matrix4Transit
Translates this matrix object along the x, y, and z axes. Translates this matrix object along the x, y, and z axes.
...@@ -282,16 +282,14 @@ Translates this matrix object along the x, y, and z axes. ...@@ -282,16 +282,14 @@ Translates this matrix object along the x, y, and z axes.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ----------------------------------------------------------- | | ------ | ----------------------------------- | ---- | -------------- |
| x | number | No | Translation distance along the x-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)| | option | [TranslateOption](#translateoption) | Yes | Translation configuration.|
| y | number | No | Translation distance along the y-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
| z | number | No | Translation distance along the z-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------- | | --------------------------------- | ---------------------------- |
| Matrix4Transit | Matrix object after the translation effect is added.| | [Matrix4Transit](#matrix4transit) | Matrix object after the translation.|
**Example** **Example**
...@@ -319,7 +317,7 @@ struct Test { ...@@ -319,7 +317,7 @@ struct Test {
### scale ### scale
scale({x?: number, y?: number, z?: number, centerX?: number, centerY?: number}): Matrix4Transit scale(options: ScaleOption): Matrix4Transit
Scales this matrix object along the x, y, and z axes. Scales this matrix object along the x, y, and z axes.
...@@ -328,19 +326,16 @@ Scales this matrix object along the x, y, and z axes. ...@@ -328,19 +326,16 @@ Scales this matrix object along the x, y, and z axes.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------------ | | ------ | --------------------------- | ---- | -------------- |
| x | number | No | Scaling multiple along the x-axis. If the value is greater than 1, the image is scaled up along the x-axis. If the value is less than 1, the image is scaled down along the x-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.| | option | [ScaleOption](#scaleoption) | Yes | Scaling configuration.|
| y | number | No | Scaling multiple along the y-axis. If the value is greater than 1, the image is scaled up along the y-axis. If the value is less than 1, the image is scaled down along the y-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.|
| z | number | No | Scaling multiple along the z-axis. If the value is greater than 1, the image is scaled up along the z-axis. If the value is less than 1, the image is scaled down along the z-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.|
| centerX | number | No | X coordinate of the center point.<br>Default value: **0**<br>Value range: (-∞, +∞) |
| centerY | number | No | Y coordinate of the center point.<br>Default value: **0**<br>Value range: (-∞, +∞) |
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------- | | --------------------------------- | ---------------------------- |
| Matrix4Transit | Matrix object after the scaling effect is added.| | [Matrix4Transit](#matrix4transit) | Matrix object after the scaling.|
**Example** **Example**
...@@ -367,7 +362,7 @@ struct Test { ...@@ -367,7 +362,7 @@ struct Test {
### rotate ### rotate
rotate({x?: number, y?: number, z?: number, angle?: number, centerX?: Length, centerY?: Length}): Matrix4Transit rotate(options: RotateOption): Matrix4Transit
Rotates this matrix object along the x, y, and z axes. Rotates this matrix object along the x, y, and z axes.
...@@ -376,20 +371,16 @@ Rotates this matrix object along the x, y, and z axes. ...@@ -376,20 +371,16 @@ Rotates this matrix object along the x, y, and z axes.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------- | | ------ | ----------------------------- | ---- | -------------- |
| x | number | No | X coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)| | option | [RotateOption](#rotateoption) | Yes | Rotation configuration.|
| y | number | No | Y coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)|
| z | number | No | Z coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)|
| angle | number | No | Rotation angle.<br>Default value: **0** |
| centerX | number | No | X coordinate of the center point.<br>Default value: **0** |
| centerY | number | No | Y coordinate of the center point.<br>Default value: **0** |
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------------------- | | --------------------------------- | ---------------------------- |
| Matrix4Transit | Matrix object after the rotation effect is added.| | [Matrix4Transit](#matrix4transit) | Matrix object after the rotation.|
**Example** **Example**
...@@ -417,7 +408,7 @@ struct Test { ...@@ -417,7 +408,7 @@ struct Test {
### transformPoint ### transformPoint
transformPoint(point: Point): Point transformPoint(options: [number, number]): [number, number]
Applies the current transformation effect to a coordinate point. Applies the current transformation effect to a coordinate point.
...@@ -427,14 +418,14 @@ Applies the current transformation effect to a coordinate point. ...@@ -427,14 +418,14 @@ Applies the current transformation effect to a coordinate point.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ----- | ---- | ------------------ | | ------ | ---------------- | ---- | ------------------ |
| point | Point | Yes | Point to be transformed.| | option | [number, number] | Yes | Point to be transformed.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----- | ---------------- | | ---------------- | --------------------------- |
| Point | Point object after matrix transformation| | [number, number] | Point object after matrix transformation|
**Example** **Example**
...@@ -472,3 +463,38 @@ struct Test { ...@@ -472,3 +463,38 @@ struct Test {
``` ```
![en-us_image_0000001219864133](figures/en-us_image_0000001219864133.PNG) ![en-us_image_0000001219864133](figures/en-us_image_0000001219864133.PNG)
## TranslateOption
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ----------------------------------------------------------- |
| x | number | No | Translation distance along the x-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
| y | number | No | Translation distance along the y-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
| z | number | No | Translation distance along the z-axis, in px.<br>Default value: **0**<br>Value range: (-∞, +∞)|
## ScaleOption
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------------ |
| x | number | No | Scaling multiple along the x-axis. If the value is greater than 1, the image is scaled up along the x-axis. If the value is less than 1, the image is scaled down along the x-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.|
| y | number | No | Scaling multiple along the y-axis. If the value is greater than 1, the image is scaled up along the y-axis. If the value is less than 1, the image is scaled down along the y-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.|
| z | number | No | Scaling multiple along the z-axis. If the value is greater than 1, the image is scaled up along the z-axis. If the value is less than 1, the image is scaled down along the z-axis.<br>Default value: **1**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 0 evaluates to the default value.|
| centerX | number | No | X coordinate of the center point.<br>Default value: **0**<br>Value range: (-∞, +∞) |
| centerY | number | No | Y coordinate of the center point.<br>Default value: **0**<br>Value range: (-∞, +∞) |
## RotateOption
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------- |
| x | number | No | X coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)|
| y | number | No | Y coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)|
| z | number | No | Z coordinate of the rotation axis vector.<br>Default value: **1**<br>Value range: (-∞, +∞)|
| angle | number | No | Rotation angle.<br>Default value: **0** |
| centerX | number | No | X coordinate of the center point.<br>Default value: **0** |
| centerY | number | No | Y coordinate of the center point.<br>Default value: **0** |
...@@ -6,7 +6,7 @@ The **mediaquery** module provides different styles for different media types. ...@@ -6,7 +6,7 @@ The **mediaquery** module provides different styles for different media types.
> >
> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
> >
> This module can be used only after a component instance is created, and it cannot be used in the [UIAbility](./js-apis-app-ability-uiAbility.md). > This module cannot be used in the file declaration of the [UIAbility](./js-apis-app-ability-uiAbility.md). In other words, the APIs of this module can be used only after a component instance is created; they cannot be called in the lifecycle of the UIAbility.
## Modules to Import ## Modules to Import
......
...@@ -262,7 +262,7 @@ pluginComponentManager.push( ...@@ -262,7 +262,7 @@ pluginComponentManager.push(
name: "ets/pages/plugin2.js", name: "ets/pages/plugin2.js",
data: { data: {
"js": "ets/pages/plugin.js", "js": "ets/pages/plugin.js",
"key_1": 1111, , "key_1": 1111,
}, },
extraData: { extraData: {
"extra_str": "this is push event" "extra_str": "this is push event"
...@@ -376,7 +376,6 @@ Listens for events of the request type and returns the requested data, or listen ...@@ -376,7 +376,6 @@ Listens for events of the request type and returns the requested data, or listen
| eventType | string | Yes | Type of the event to listen for. The options are as follows:<br>**"push"**: The component provider pushes data to the component consumer.<br>**"request"**: The component consumer proactively requests data from the component provider.| | eventType | string | Yes | Type of the event to listen for. The options are as follows:<br>**"push"**: The component provider pushes data to the component consumer.<br>**"request"**: The component consumer proactively requests data from the component provider.|
| callback | [OnPushEventCallback](#onpusheventcallback)&nbsp;\|&nbsp;[OnRequestEventCallback](#onrequesteventcallback) | Yes | Callback used to return the result. The type is [OnPushEventCallback](#onpusheventcallback) for the push event and [OnRequestEventCallback](#onrequesteventcallback) for the request event.| | callback | [OnPushEventCallback](#onpusheventcallback)&nbsp;\|&nbsp;[OnRequestEventCallback](#onrequesteventcallback) | Yes | Callback used to return the result. The type is [OnPushEventCallback](#onpusheventcallback) for the push event and [OnRequestEventCallback](#onrequesteventcallback) for the request event.|
**Example** **Example**
```js ```js
......
...@@ -6,7 +6,7 @@ The **PromptAction** module provides APIs for creating and showing toasts, dialo ...@@ -6,7 +6,7 @@ The **PromptAction** module provides APIs for creating and showing toasts, dialo
> >
> 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.
> >
> This module can be used only after a component instance is created, and it cannot be used in the [UIAbility](./js-apis-app-ability-uiAbility.md). > This module cannot be used in the file declaration of the [UIAbility](./js-apis-app-ability-uiAbility.md). In other words, the APIs of this module can be used only after a component instance is created; they cannot be called in the lifecycle of the UIAbility.
## Modules to Import ## Modules to Import
......
...@@ -671,7 +671,7 @@ struct Second { ...@@ -671,7 +671,7 @@ struct Second {
Text(this.text) Text(this.text)
.fontSize(30) .fontSize(30)
.onClick(() => { .onClick(() => {
this.secondData = (this.data.['array'][1]).toString() this.secondData = (this.data['array'][1]).toString()
}) })
.margin({ top: 20 }) .margin({ top: 20 })
Text(`This is the data passed from the first page: ${this.secondData}`) Text(`This is the data passed from the first page: ${this.secondData}`)
......
...@@ -247,7 +247,7 @@ Obtains the data size of this **MessageSequence** object. ...@@ -247,7 +247,7 @@ Obtains the data size of this **MessageSequence** object.
| Type | Description | | Type | Description |
| ------ | ----------------------------------------------- | | ------ | ----------------------------------------------- |
| number | Size of the **MessageSequence** object obtained, in bytes.| | number | Size of the **MessageSequence** instance obtained, in bytes.|
**Example** **Example**
...@@ -293,6 +293,14 @@ Sets the size of the data contained in this **MessageSequence** object. ...@@ -293,6 +293,14 @@ Sets the size of the data contained in this **MessageSequence** object.
| ------ | ------ | ---- | ------ | | ------ | ------ | ---- | ------ |
| size | number | Yes | Data size to set, in bytes.| | size | number | Yes | Data size to set, in bytes.|
**Error codes**
For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md).
| ID| Error Message|
| -------- | -------- |
| 1900009 | write data to message sequence failed |
**Example** **Example**
```ts ```ts
...@@ -326,6 +334,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -326,6 +334,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 1900009 | write data to message sequence failed |
| 1900011 | parcel memory alloc failed | | 1900011 | parcel memory alloc failed |
**Example** **Example**
...@@ -452,6 +461,12 @@ Moves the read pointer to the specified position. ...@@ -452,6 +461,12 @@ Moves the read pointer to the specified position.
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| pos | number | Yes | Position from which data is to read.| | pos | number | Yes | Position from which data is to read.|
**Error codes**
| ID| Error Message|
| -------- | -------- |
| 1900010 | read data from message sequence failed |
**Example** **Example**
```ts ```ts
...@@ -484,6 +499,12 @@ Moves the write pointer to the specified position. ...@@ -484,6 +499,12 @@ Moves the write pointer to the specified position.
| ------ | ------ | ---- | ----- | | ------ | ------ | ---- | ----- |
| pos | number | Yes | Position from which data is to write.| | pos | number | Yes | Position from which data is to write.|
**Error codes**
| ID| Error Message|
| -------- | -------- |
| 1900009 | write data to message sequence failed |
**Example** **Example**
```ts ```ts
...@@ -2718,7 +2739,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -2718,7 +2739,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
} }
``` ```
### closeFileDescriptor<sup>9+</sup> ### closeFileDescriptor<sup>9+</sup>
static closeFileDescriptor(fd: number): void static closeFileDescriptor(fd: number): void
...@@ -2805,7 +2825,6 @@ Checks whether this **MessageSequence** object contains file descriptors. ...@@ -2805,7 +2825,6 @@ Checks whether this **MessageSequence** object contains file descriptors.
**Example** **Example**
```ts ```ts
import fs from '@ohos.file.fs'; import fs from '@ohos.file.fs';
let sequence = new rpc.MessageSequence(); let sequence = new rpc.MessageSequence();
...@@ -2926,8 +2945,8 @@ Writes an anonymous shared object to this **MessageSequence** object. ...@@ -2926,8 +2945,8 @@ Writes an anonymous shared object to this **MessageSequence** object.
For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md).
| ID| Error Message| | ID| Error Message|
| -------- | ------- | | -------- | -------- |
| 1900003 | write to ashmem failed | | 1900009 | write data to message sequence failed |
**Example** **Example**
...@@ -2948,7 +2967,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -2948,7 +2967,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
} }
``` ```
### readAshmem ### readAshmem
readAshmem(): Ashmem readAshmem(): Ashmem
...@@ -2969,7 +2987,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -2969,7 +2987,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 1900004 | read from ashmem failed | | 1900010 | read data from message sequence failed |
**Example** **Example**
...@@ -3263,7 +3281,6 @@ Writes an interface token to this **MessageParcel** object. The remote object ca ...@@ -3263,7 +3281,6 @@ Writes an interface token to this **MessageParcel** object. The remote object ca
console.log("RpcServer: writeInterfaceToken is " + result); console.log("RpcServer: writeInterfaceToken is " + result);
``` ```
### readInterfaceToken ### readInterfaceToken
readInterfaceToken(): string readInterfaceToken(): string
...@@ -5825,7 +5842,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -5825,7 +5842,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. |
| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -5836,7 +5853,6 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -5836,7 +5853,6 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| ------- | -------------------------------- | | ------- | -------------------------------- |
| boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.|
### sendRequest<sup>8+(deprecated)</sup> ### sendRequest<sup>8+(deprecated)</sup>
>This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9). >This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9).
...@@ -5851,7 +5867,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -5851,7 +5867,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ---------------------------------------- | ---- | -------------------------------------------------------------------------------------- | | ------- | ---------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. |
| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -5862,7 +5878,6 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -5862,7 +5878,6 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| -------------------------------- | --------------------------------------------- | | -------------------------------- | --------------------------------------------- |
| Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.| | Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.|
### sendMessageRequest<sup>9+</sup> ### sendMessageRequest<sup>9+</sup>
sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise&lt;RequestResult&gt; sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise&lt;RequestResult&gt;
...@@ -5875,7 +5890,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -5875,7 +5890,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | | ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. |
| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -5886,7 +5901,6 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -5886,7 +5901,6 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| ---------------------------- | ----------------------------------------- | | ---------------------------- | ----------------------------------------- |
| Promise&lt;RequestResult&gt; | Promise used to return the **requestResult** object.| | Promise&lt;RequestResult&gt; | Promise used to return the **requestResult** object.|
### sendMessageRequest<sup>9+</sup> ### sendMessageRequest<sup>9+</sup>
sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback&lt;RequestResult&gt;): void sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback&lt;RequestResult&gt;): void
...@@ -5899,7 +5913,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -5899,7 +5913,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | | -------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. |
| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -5919,7 +5933,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -5919,7 +5933,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | | -------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. |
| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -5946,7 +5960,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -5946,7 +5960,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 1900008 | proxy or remote object is invalid | | 1900005 | only proxy object permitted |
### addDeathrecipient<sup>(deprecated)</sup> ### addDeathrecipient<sup>(deprecated)</sup>
...@@ -5971,7 +5985,6 @@ Adds a callback for receiving death notifications of the remote object. This met ...@@ -5971,7 +5985,6 @@ Adds a callback for receiving death notifications of the remote object. This met
| ------- | ---------------------------------------- | | ------- | ---------------------------------------- |
| boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| | boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.|
### unregisterDeathRecipient<sup>9+</sup> ### unregisterDeathRecipient<sup>9+</sup>
unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void
...@@ -5993,7 +6006,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -5993,7 +6006,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 1900008 | proxy or remote object is invalid | | 1900005 | only proxy object permitted |
### removeDeathRecipient<sup>(deprecated)</sup> ### removeDeathRecipient<sup>(deprecated)</sup>
...@@ -6040,7 +6053,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6040,7 +6053,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| -------- | -------- | | -------- | -------- |
| 1900008 | proxy or remote object is invalid | | 1900008 | proxy or remote object is invalid |
### getInterfaceDescriptor<sup>(deprecated)</sup> ### getInterfaceDescriptor<sup>(deprecated)</sup>
>This API is no longer maintained since API version 9. You are advised to use [getDescriptor](#getdescriptor9). >This API is no longer maintained since API version 9. You are advised to use [getDescriptor](#getdescriptor9).
...@@ -6057,7 +6069,6 @@ Obtains the interface descriptor (which is a string) of this object. ...@@ -6057,7 +6069,6 @@ Obtains the interface descriptor (which is a string) of this object.
| ------ | ---------------- | | ------ | ---------------- |
| string | Interface descriptor obtained.| | string | Interface descriptor obtained.|
### isObjectDead ### isObjectDead
isObjectDead(): boolean isObjectDead(): boolean
...@@ -6072,7 +6083,6 @@ Checks whether this object is dead. ...@@ -6072,7 +6083,6 @@ Checks whether this object is dead.
| ------- | ---------------------------------- | | ------- | ---------------------------------- |
| boolean | Returns **true** if the object is dead; returns **false** otherwise.| | boolean | Returns **true** if the object is dead; returns **false** otherwise.|
## RemoteProxy ## RemoteProxy
Provides APIs to implement **IRemoteObject**. Provides APIs to implement **IRemoteObject**.
...@@ -6101,7 +6111,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -6101,7 +6111,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. |
| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -6177,7 +6187,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -6177,7 +6187,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | | ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. |
| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -6261,7 +6271,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -6261,7 +6271,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. |
| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -6343,7 +6353,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -6343,7 +6353,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | | -------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. |
| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -6424,7 +6434,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -6424,7 +6434,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | | -------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. |
| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -7080,12 +7090,11 @@ Provides common message options (flag and wait time). Use the specified flag to ...@@ -7080,12 +7090,11 @@ Provides common message options (flag and wait time). Use the specified flag to
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
| Name | Value | Description | | Name | Value | Description |
| ------------- | ---- | ----------------------------------------------------------- | | ------------- | --------- | ----------------------------------------------------------- |
| TF_SYNC | 0 | Synchronous call. | | TF_SYNC | 0 (0x00) | Synchronous call. |
| TF_ASYNC | 1 | Asynchronous call. | | TF_ASYNC | 1 (0x01) | Asynchronous call. |
| TF_ACCEPT_FDS | 0x10 | Indication to **sendMessageRequest<sup>9+</sup>** for returning the file descriptor.| | TF_ACCEPT_FDS | 16 (0x10) | Indication to **sendMessageRequest<sup>9+</sup>** for returning the file descriptor.|
| TF_WAIT_TIME | 8 | Default waiting time, in seconds. | | TF_WAIT_TIME | 4 (0x4) | Default waiting time, in seconds. |
### constructor<sup>9+</sup> ### constructor<sup>9+</sup>
...@@ -7101,7 +7110,6 @@ A constructor used to create a **MessageOption** object. ...@@ -7101,7 +7110,6 @@ A constructor used to create a **MessageOption** object.
| ------ | ------- | ---- | -------------------------------------- | | ------ | ------- | ---- | -------------------------------------- |
| async | boolean | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.| | async | boolean | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.|
**Example** **Example**
```ts ```ts
...@@ -7391,7 +7399,6 @@ Obtains the caller's token ID, which is used to verify the caller identity. ...@@ -7391,7 +7399,6 @@ Obtains the caller's token ID, which is used to verify the caller identity.
} }
``` ```
### getCallingDeviceID ### getCallingDeviceID
static getCallingDeviceID(): string static getCallingDeviceID(): string
...@@ -7484,7 +7491,6 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp ...@@ -7484,7 +7491,6 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp
| ------ | ------------------------------- | ---- | ------------------- | | ------ | ------------------------------- | ---- | ------------------- |
| object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | | object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. |
**Example** **Example**
```ts ```ts
...@@ -7577,7 +7583,6 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. ...@@ -7577,7 +7583,6 @@ Changes the UID and PID of the remote user to the UID and PID of the local user.
} }
``` ```
### restoreCallingIdentity<sup>9+</sup> ### restoreCallingIdentity<sup>9+</sup>
static restoreCallingIdentity(identity: string): void static restoreCallingIdentity(identity: string): void
...@@ -7667,7 +7672,6 @@ A constructor used to create a **RemoteObject** object. ...@@ -7667,7 +7672,6 @@ A constructor used to create a **RemoteObject** object.
| ---------- | ------ | ---- | ------------ | | ---------- | ------ | ---- | ------------ |
| descriptor | string | Yes | Interface descriptor.| | descriptor | string | Yes | Interface descriptor.|
### sendRequest<sup>(deprecated)</sup> ### sendRequest<sup>(deprecated)</sup>
>This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9). >This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9).
...@@ -7682,7 +7686,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -7682,7 +7686,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. |
| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -7748,7 +7752,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -7748,7 +7752,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. |
| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -7818,7 +7822,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -7818,7 +7822,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | | ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. |
| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -7874,7 +7878,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -7874,7 +7878,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | | ------------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. |
| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -7924,7 +7928,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -7924,7 +7928,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | | ------------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. |
| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. |
| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. |
...@@ -8239,7 +8243,6 @@ Obtains the interface descriptor. ...@@ -8239,7 +8243,6 @@ Obtains the interface descriptor.
| ------------- | --------------------------------------------- | | ------------- | --------------------------------------------- |
| IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| | IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.|
**Example** **Example**
```ts ```ts
...@@ -8612,7 +8615,6 @@ Creates an **Ashmem** object by copying the file descriptor of an existing **Ash ...@@ -8612,7 +8615,6 @@ Creates an **Ashmem** object by copying the file descriptor of an existing **Ash
| ------ | ---------------------- | | ------ | ---------------------- |
| Ashmem | **Ashmem** object created.| | Ashmem | **Ashmem** object created.|
**Example** **Example**
```ts ```ts
......
...@@ -96,9 +96,9 @@ Subscribes to events related to the screen state. ...@@ -96,9 +96,9 @@ Subscribes to events related to the screen state.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ---------------------- | ---- | ------------------------------------------------------------ | | --------- | ---------------------- | ---- | ----------------------------------------------------------- |
| eventType | string | Yes | Event type.<br>- **connect**: an event indicating that the screen is connected.<br>- **disconnect**: an event indicating that the screen is disconnected.<br>- **change**: an event indicating that the screen state changes.| | eventType | string | Yes | Event type.<br>- **connect**: an event indicating that the screen is connected.<br>- **disconnect**: an event indicating that the screen is disconnected.<br>- **change**: an event indicating that the screen state changes.|
| callback | Callback&lt;number&gt; | Yes | Callback used to return the screen ID. | | callback | Callback&lt;number&gt; | Yes | Callback used to return the screen ID, which is an integer. |
**Example** **Example**
...@@ -126,7 +126,7 @@ Unsubscribes from events related to the screen state. ...@@ -126,7 +126,7 @@ Unsubscribes from events related to the screen state.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ---------------------- | ---- | ------------------------------------------------------------ | | --------- | ---------------------- | ---- | ------------------------------------------------------------ |
| eventType | string | Yes | Event type.<br>- **connect**: an event indicating that the screen is connected.<br>- **disconnect**: an event indicating that the screen is disconnected.<br>- **change**: an event indicating that the screen state changes.| | eventType | string | Yes | Event type.<br>- **connect**: an event indicating that the screen is connected.<br>- **disconnect**: an event indicating that the screen is disconnected.<br>- **change**: an event indicating that the screen state changes.|
| callback | Callback&lt;number&gt; | No | Callback used to return the screen ID. | | callback | Callback&lt;number&gt; | No | Callback used to return the screen ID, which is an integer. |
**Example** **Example**
...@@ -152,9 +152,9 @@ Sets the screen to the expanded mode. This API uses an asynchronous callback to ...@@ -152,9 +152,9 @@ Sets the screen to the expanded mode. This API uses an asynchronous callback to
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------ | ---- | -------------------------------- | | -------- | ------------------------------------------ | ---- |----------------------------|
| options | Array&lt;[ExpandOption](#expandoption)&gt; | Yes | Parameters for expanding the screen. | | options | Array&lt;[ExpandOption](#expandoption)&gt; | Yes | Parameters for expanding the screen. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the group ID of the expanded screens.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the group ID of the expanded screens, which is an integer.|
**Error codes** **Error codes**
...@@ -199,8 +199,8 @@ Sets the screen to the expanded mode. This API uses a promise to return the resu ...@@ -199,8 +199,8 @@ Sets the screen to the expanded mode. This API uses a promise to return the resu
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ----------------------------------- | | --------------------- |---------------------------------|
| Promise&lt;number&gt; | Promise used to return the group ID of the expanded screens.| | Promise&lt;number&gt; | Promise used to return the group ID of the expanded screens, which is an integer.|
**Error codes** **Error codes**
...@@ -235,10 +235,10 @@ Sets screen mirroring. This API uses an asynchronous callback to return the resu ...@@ -235,10 +235,10 @@ Sets screen mirroring. This API uses an asynchronous callback to return the resu
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------ | --------------------------- | ---- |-----------------| | ------------ | --------------------------- | ---- |--------------------|
| mainScreen | number | Yes | ID of the primary screen. | | mainScreen | number | Yes | ID of the primary screen. The value must be an integer. |
| mirrorScreen | Array&lt;number&gt; | Yes | IDs of secondary screens. | | mirrorScreen | Array&lt;number&gt; | Yes | IDs of secondary screens. Each ID must be an integer.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the group ID of the secondary screens.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the group ID of the secondary screens, which is an integer. |
**Error codes** **Error codes**
...@@ -277,15 +277,15 @@ Sets screen mirroring. This API uses a promise to return the result. ...@@ -277,15 +277,15 @@ Sets screen mirroring. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------ | ------------------- | ---- |-----------| | ------------ | ------------------- | ---- |--------------------|
| mainScreen | number | Yes | ID of the primary screen. | | mainScreen | number | Yes | ID of the primary screen. The value must be an integer. |
| mirrorScreen | Array&lt;number&gt; | Yes | IDs of secondary screens.| | mirrorScreen | Array&lt;number&gt; | Yes | IDs of secondary screens. Each ID must be an integer.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ----------------------------------- | | --------------------- |---------------------------------|
| Promise&lt;number&gt; | Promise used to return the group ID of the secondary screens.| | Promise&lt;number&gt; | Promise used to return the group ID of the secondary screens, which is an integer.|
**Error codes** **Error codes**
...@@ -424,7 +424,7 @@ Destroys a virtual screen. This API uses an asynchronous callback to return the ...@@ -424,7 +424,7 @@ Destroys a virtual screen. This API uses an asynchronous callback to return the
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| screenId | number | Yes | Screen ID. | | screenId | number | Yes | Screen ID. The value must be an integer. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the virtual screen is destroyed, **err** is **undefined**; otherwise, **err** is an error object.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the virtual screen is destroyed, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -464,7 +464,7 @@ Destroys a virtual screen. This API uses a promise to return the result. ...@@ -464,7 +464,7 @@ Destroys a virtual screen. This API uses a promise to return the result.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------ | ---- | ---------- | | -------- | ------ | ---- | ---------- |
| screenId | number | Yes | Screen ID.| | screenId | number | Yes | Screen ID. The value must be an integer.|
**Return value** **Return value**
...@@ -509,7 +509,7 @@ Sets the surface for a virtual screen. This API uses an asynchronous callback to ...@@ -509,7 +509,7 @@ Sets the surface for a virtual screen. This API uses an asynchronous callback to
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ------------------------------------------------------------ | | --------- | ------------------------- | ---- | ------------------------------------------------------------ |
| screenId | number | Yes | Screen ID. | | screenId | number | Yes | Screen ID. The value must be an integer. |
| surfaceId | string | Yes | Surface ID. | | surfaceId | string | Yes | Surface ID. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the virtual screen surface is successfully set, **err** is **undefined**; otherwise, **err** is an error object.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the virtual screen surface is successfully set, **err** is **undefined**; otherwise, **err** is an error object.|
...@@ -553,7 +553,7 @@ Sets the surface for a virtual screen. This API uses a promise to return the res ...@@ -553,7 +553,7 @@ Sets the surface for a virtual screen. This API uses a promise to return the res
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------ | ---- | ------------- | | --------- | ------ | ---- | ------------- |
| screenId | number | Yes | Screen ID. | | screenId | number | Yes | Screen ID. The value must be an integer. |
| surfaceId | string | Yes | Surface ID.| | surfaceId | string | Yes | Surface ID.|
**Return value** **Return value**
...@@ -711,9 +711,9 @@ Defines the parameters for expanding a screen. ...@@ -711,9 +711,9 @@ Defines the parameters for expanding a screen.
| Name | Type| Readable| Writable| Description | | Name | Type| Readable| Writable| Description |
| -------- | -------- | ---- | ---- | ------------------- | | -------- | -------- | ---- | ---- | ------------------- |
| screenId | number | Yes | Yes | Screen ID. | | screenId | number | Yes | Yes | Screen ID. The value must be an integer. |
| startX | number | Yes | Yes | Start X coordinate of the screen.| | startX | number | Yes | Yes | Start X coordinate of the screen. The value must be an integer.|
| startY | number | Yes | Yes | Start Y coordinate of the screen.| | startY | number | Yes | Yes | Start Y coordinate of the screen. The value must be an integer.|
## VirtualScreenOption ## VirtualScreenOption
...@@ -722,12 +722,12 @@ Defines virtual screen parameters. ...@@ -722,12 +722,12 @@ Defines virtual screen parameters.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type| Readable| Writable| Description | | Name | Type| Readable| Writable| Description |
| --------- | -------- | ---- | ---- | ------------------------- | | --------- | -------- | ---- | ---- |--------------------------|
| name | string | Yes | Yes | Name of a virtual screen. | | name | string | Yes | Yes | Name of a virtual screen. |
| width | number | Yes | Yes | Width of the virtual screen, in pixels.| | width | number | Yes | Yes | Width of the virtual screen, in pixels. The value must be an integer.|
| height | number | Yes | Yes | Height of the virtual screen, in pixels.| | height | number | Yes | Yes | Height of the virtual screen, in pixels. The value must be an integer.|
| density | number | Yes | Yes | Density of the virtual screen. | | density | number | Yes | Yes | Density of the virtual screen. The value must be a floating point number. |
| surfaceId | string | Yes | Yes | Surface ID of the virtual screen.| | surfaceId | string | Yes | Yes | Surface ID of the virtual screen. |
## Screen ## Screen
...@@ -738,11 +738,11 @@ Before calling any API in **Screen**, you must use **[getAllScreens()](#screenge ...@@ -738,11 +738,11 @@ Before calling any API in **Screen**, you must use **[getAllScreens()](#screenge
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------------- | ---------------------------------------------- | ---- | ---- | ---------------------- | | ----------------- | ---------------------------------------------- | ---- | ---- |-------------------------------------------------------------|
| id | number | Yes | No | Screen ID. | | id | number | Yes | No | Screen ID. The value must be an integer. |
| parent | number | Yes | No | ID of the group to which a screen belongs. | | parent | number | Yes | No | ID of the group to which a screen belongs. The value must be an integer. |
| supportedModeInfo | Array&lt;[ScreenModeInfo](#screenmodeinfo)&gt; | Yes | No | Mode set supported by the screen. | | supportedModeInfo | Array&lt;[ScreenModeInfo](#screenmodeinfo)&gt; | Yes | No | Mode set supported by the screen. |
| activeModeIndex | number | Yes | No | Index of the active screen mode. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware.| | activeModeIndex | number | Yes | No | Index of the active screen mode. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware. The value must be an integer.|
| orientation | [Orientation](#orientation) | Yes | No | Screen orientation. | | orientation | [Orientation](#orientation) | Yes | No | Screen orientation. |
### setOrientation ### setOrientation
...@@ -833,7 +833,7 @@ Sets the active mode of the screen. This API uses an asynchronous callback to re ...@@ -833,7 +833,7 @@ Sets the active mode of the screen. This API uses an asynchronous callback to re
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ------------------------------------------------------------ | | --------- | ------------------------- | ---- | ------------------------------------------------------------ |
| modeIndex | number | Yes | Index of the mode to set. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware.| | modeIndex | number | Yes | Index of the mode to set. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware. The value must be an integer.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the active mode is successfully set, **err** is **undefined**; otherwise, **err** is an error object.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the active mode is successfully set, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -871,7 +871,7 @@ Sets the active mode of the screen. This API uses a promise to return the result ...@@ -871,7 +871,7 @@ Sets the active mode of the screen. This API uses a promise to return the result
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------ | ---- | ---------- | | --------- | ------ | ---- | ---------- |
| modeIndex | number | Yes | Index of the mode to set. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware.| | modeIndex | number | Yes | Index of the mode to set. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware. The value must be an integer.|
**Return value** **Return value**
...@@ -912,8 +912,8 @@ Sets the pixel density of the screen. This API uses an asynchronous callback to ...@@ -912,8 +912,8 @@ Sets the pixel density of the screen. This API uses an asynchronous callback to
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------- | ---- | ------------------------------------------------------------ | | ---------- | ------------------------- | ---- |------------------------------------------|
| densityDpi | number | Yes | Pixel density. The value ranges from 80 to 640. | | densityDpi | number | Yes | Pixel density. The value must be an integer in the range [80, 640]. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the pixel density is successfully set, **err** is **undefined**; otherwise, **err** is an error object.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the pixel density is successfully set, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -950,8 +950,8 @@ Sets the pixel density of the screen. This API uses a promise to return the resu ...@@ -950,8 +950,8 @@ Sets the pixel density of the screen. This API uses a promise to return the resu
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | ---------------------------------- | | ---------- | ------ | ---- |------------------------------------|
| densityDpi | number | Yes | Pixel density. The value ranges from 80 to 640.| | densityDpi | number | Yes | Pixel density. The value must be an integer in the range [80, 640].|
**Return value** **Return value**
...@@ -1005,7 +1005,7 @@ Defines the screen mode information. ...@@ -1005,7 +1005,7 @@ Defines the screen mode information.
| Name | Type| Readable| Writable| Description | | Name | Type| Readable| Writable| Description |
| ----------- | -------- | ---- | ---- | -------------------------------------------------- | | ----------- | -------- | ---- | ---- | -------------------------------------------------- |
| id | number | Yes | Yes | Mode ID. The supported mode is determined by the device resolution and refresh rate.| | id | number | Yes | Yes | Mode ID. The supported mode is determined by the device resolution and refresh rate. The value must be an integer.|
| width | number | Yes | Yes | Width of the screen, in pixels. | | width | number | Yes | Yes | Width of the screen, in pixels. The value must be an integer. |
| height | number | Yes | Yes | Height of the screen, in pixels. | | height | number | Yes | Yes | Height of the screen, in pixels. The value must be an integer. |
| refreshRate | number | Yes | Yes | Screen refresh rate. | | refreshRate | number | Yes | Yes | Refresh rate of the screen. The value must be an integer. |
...@@ -25,8 +25,8 @@ Describes screenshot options. ...@@ -25,8 +25,8 @@ Describes screenshot options.
| ---------------------- | ------------- | ---- | ------------------------------------------------------------ | | ---------------------- | ------------- | ---- | ------------------------------------------------------------ |
| screenRect | [Rect](#rect) | No | Region of the screen to capture. If this parameter is null, the full screen will be captured. | | screenRect | [Rect](#rect) | No | Region of the screen to capture. If this parameter is null, the full screen will be captured. |
| imageSize | [Size](#size) | No | Size of the screen region to capture. If this parameter is null, the full screen will be captured. | | imageSize | [Size](#size) | No | Size of the screen region to capture. If this parameter is null, the full screen will be captured. |
| rotation | number | No | Rotation angle of the screenshot. Currently, the value can be **0** only. The default value is **0**. | | rotation | number | No | Rotation angle of the screenshot. Currently, the value can be **0** only. The default value is **0**. The value must be an integer. |
| displayId<sup>8+</sup> | number | No | ID of the [display](js-apis-display.md#display) device on which the screen region is to be captured.| | displayId<sup>8+</sup> | number | No | ID of the [display](js-apis-display.md#display) device on which the screen region is to be captured. The value must be an integer.|
## Rect ## Rect
...@@ -37,10 +37,10 @@ Describes the region of the screen to capture. ...@@ -37,10 +37,10 @@ Describes the region of the screen to capture.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| left | number | Yes | Left boundary of the screen region to capture, in pixels.| | left | number | Yes | Left boundary of the screen region to capture, in pixels. The value must be an integer.|
| top | number | Yes | Top boundary of the screen region to capture, in pixels.| | top | number | Yes | Top boundary of the screen region to capture, in pixels. The value must be an integer.|
| width | number | Yes | Width of the screen region to capture, in pixels.| | width | number | Yes | Width of the screen region to capture, in pixels. The value must be an integer.|
| height | number | Yes | Height of the screen region to capture, in pixels.| | height | number | Yes | Height of the screen region to capture, in pixels. The value must be an integer.|
## Size ## Size
...@@ -51,8 +51,8 @@ Describes the size of the screen region to capture. ...@@ -51,8 +51,8 @@ Describes the size of the screen region to capture.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| width | number | Yes | Width of the screen region to capture, in pixels.| | width | number | Yes | Width of the screen region to capture, in pixels. The value must be an integer.|
| height | number | Yes | Height of the screen region to capture, in pixels.| | height | number | Yes | Height of the screen region to capture, in pixels. The value must be an integer.|
## screenshot.save ## screenshot.save
...@@ -92,7 +92,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses an async ...@@ -92,7 +92,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses an async
console.log('Failed to save screenshot. Code: ' + JSON.stringify(err)); console.log('Failed to save screenshot. Code: ' + JSON.stringify(err));
return; return;
} }
console.log('Succeeded in saving screenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber()); console.log('Succeeded in saving sreenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
pixelMap.release(); // Release the memory in time after the PixelMap is used. pixelMap.release(); // Release the memory in time after the PixelMap is used.
}); });
} catch (exception) { } catch (exception) {
...@@ -125,7 +125,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses an async ...@@ -125,7 +125,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses an async
console.log('Failed to save screenshot. Code: ' + JSON.stringify(err)); console.log('Failed to save screenshot. Code: ' + JSON.stringify(err));
return; return;
} }
console.log('Succeeded in saving screenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber()); console.log('Succeeded in saving sreenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
pixelMap.release(); // Release the memory in time after the PixelMap is used. pixelMap.release(); // Release the memory in time after the PixelMap is used.
}); });
} catch (exception) { } catch (exception) {
...@@ -173,7 +173,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses a promis ...@@ -173,7 +173,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses a promis
try { try {
let promise = screenshot.save(screenshotOptions); let promise = screenshot.save(screenshotOptions);
promise.then((pixelMap) => { promise.then((pixelMap) => {
console.log('Succeeded in saving screenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber()); console.log('Succeeded in saving sreenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
pixelMap.release(); // Release the memory in time after the PixelMap is used. pixelMap.release(); // Release the memory in time after the PixelMap is used.
}).catch((err) => { }).catch((err) => {
console.log('Failed to save screenshot. Code: ' + JSON.stringify(err)); console.log('Failed to save screenshot. Code: ' + JSON.stringify(err));
......
...@@ -249,7 +249,7 @@ Sets the value for a data item. This API uses a promise to return the result. ...@@ -249,7 +249,7 @@ Sets the value for a data item. This API uses a promise to return the result.
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
// Update the value of SCREEN_BRIGHTNESS_STATUS. (As this data item exists in the database, the setValue API will update the value of the data item.) // Update the value of SCREEN_BRIGHTNESS_STATUS. (As this data item exists in the database, the setValue API will update its value.)
let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS);
let helper = featureAbility.acquireDataAbilityHelper(uri); let helper = featureAbility.acquireDataAbilityHelper(uri);
// @ts-ignore // @ts-ignore
...@@ -265,6 +265,8 @@ enableAirplaneMode(enable: boolean, callback: AsyncCallback\<void>): void ...@@ -265,6 +265,8 @@ enableAirplaneMode(enable: boolean, callback: AsyncCallback\<void>): void
Enables or disables airplane mode. This API uses an asynchronous callback to return the result. Enables or disables airplane mode. This API uses an asynchronous callback to return the result.
This API is not supported currently.
**System capability**: SystemCapability.Applications.settings.Core **System capability**: SystemCapability.Applications.settings.Core
**Parameters** **Parameters**
...@@ -293,6 +295,8 @@ enableAirplaneMode(enable: boolean): Promise\<void> ...@@ -293,6 +295,8 @@ enableAirplaneMode(enable: boolean): Promise\<void>
Enables or disables airplane mode. This API uses a promise to return the result. Enables or disables airplane mode. This API uses a promise to return the result.
This API is not supported currently.
**System capability**: SystemCapability.Applications.settings.Core **System capability**: SystemCapability.Applications.settings.Core
**Parameters** **Parameters**
......
...@@ -123,7 +123,7 @@ Unsubscribes from the device status. ...@@ -123,7 +123,7 @@ Unsubscribes from the device status.
| -------------------- | -------------------------------------------------- | ---- | ---------------------------- | | -------------------- | -------------------------------------------------- | ---- | ---------------------------- |
| activity | [ActivityType](#activitytype) | Yes | Device status type. | | activity | [ActivityType](#activitytype) | Yes | Device status type. |
| event | [ActivityEvent](#activityevent) | Yes | Event type. | | event | [ActivityEvent](#activityevent) | Yes | Event type. |
| callback | Callback<[ActivityResponse](#activityresponse)\> | No | Callback used to receive reported data. If this parameter is not passed, all callbacks associated with the specified event in the process will be unregistered. | | callback | Callback:\<[ActivityResponse](#activityresponse)> | No | Callback used to receive reported data. |
**Example** **Example**
......
...@@ -8,9 +8,9 @@ This module provides the following functions: ...@@ -8,9 +8,9 @@ This module provides the following functions:
- [Component<sup>9+</sup>](#component9): represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection. - [Component<sup>9+</sup>](#component9): represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection.
- [Driver<sup>9+</sup>](#driver9): works as the entry class and provides APIs for features such as component matching/search, key injection, coordinate clicking/sliding, and screenshot. - [Driver<sup>9+</sup>](#driver9): works as the entry class and provides APIs for features such as component matching/search, key injection, coordinate clicking/sliding, and screenshot.
- [UiWindow<sup>9+</sup>](#uiwindow9): works as the entry class and provides APIs for obtaining window attributes, dragging windows, and adjusting window sizes. - [UiWindow<sup>9+</sup>](#uiwindow9): works as the entry class and provides APIs for obtaining window attributes, dragging windows, and adjusting window sizes.
- [By<sup>(deprecated)</sup>](#bydeprecated): provides UI component feature description APIs for component filtering and matching. This API is deprecated since API version 9. You are advised to use [On<sup>9+</sup>](#on9) instead. - [By<sup>(deprecated)</sup>](#bydeprecated): provides UI component feature description APIs for component filtering and matching. This class is deprecated since API version 9. You are advised to use [On<sup>9+</sup>](#on9) instead.
- [UiComponent<sup>(deprecated)</sup>](#uicomponentdeprecated): represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection. This API is deprecated since API version 9. You are advised to use [Component<sup>9+</sup>](#component9) instead. - [UiComponent<sup>(deprecated)</sup>](#uicomponentdeprecated): represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection. This class is deprecated since API version 9. You are advised to use [Component<sup>9+</sup>](#component9) instead.
- [UiDriver<sup>(deprecated)</sup>](#uidriverdeprecated): works as the entry class and provides APIs for features such as component matching/search, key injection, coordinate clicking/sliding, and screenshot. This API is deprecated since API version 9. You are advised to use [Driver<sup>9+</sup>](#driver9) instead. - [UiDriver<sup>(deprecated)</sup>](#uidriverdeprecated): works as the entry class and provides APIs for features such as component matching/search, key injection, coordinate clicking/sliding, and screenshot. This class is deprecated since API version 9. You are advised to use [Driver<sup>9+</sup>](#driver9) instead.
>**NOTE** >**NOTE**
> >
...@@ -1119,7 +1119,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc ...@@ -1119,7 +1119,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
```js ```js
async function demo() { async function demo() {
let driver = Driver.create(); let driver = Driver.create();
let button = await driver.findComponent(ON.type('Scroll')); let scrollBar = await driver.findComponent(ON.type('Scroll'));
let button = await scrollBar.scrollSearch(ON.text('next page')); let button = await scrollBar.scrollSearch(ON.text('next page'));
} }
``` ```
...@@ -2659,6 +2659,7 @@ async function demo() { ...@@ -2659,6 +2659,7 @@ async function demo() {
## By<sup>(deprecated)</sup> ## By<sup>(deprecated)</sup>
The UiTest framework provides a wide range of UI component feature description APIs in the **By** class to filter and match components. The UiTest framework provides a wide range of UI component feature description APIs in the **By** class to filter and match components.
The API capabilities provided by the **By** class exhibit the following features: The API capabilities provided by the **By** class exhibit the following features:
- Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component. - Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component.
...@@ -2667,7 +2668,7 @@ The API capabilities provided by the **By** class exhibit the following features ...@@ -2667,7 +2668,7 @@ The API capabilities provided by the **By** class exhibit the following features
All APIs provided in the **By** class are synchronous. You are advised to use the static constructor **BY** to create a **By** object in chain mode. All APIs provided in the **By** class are synchronous. You are advised to use the static constructor **BY** to create a **By** object in chain mode.
This API is deprecated since API version 9. You are advised to use [On<sup>9+</sup>](#on9) instead. This class is deprecated since API version 9. You are advised to use [On<sup>9+</sup>](#on9) instead.
```js ```js
BY.text('123').type('button'); BY.text('123').type('button');
...@@ -2909,7 +2910,7 @@ selected(b?: boolean): By ...@@ -2909,7 +2910,7 @@ selected(b?: boolean): By
Specifies the selected status of the target component. Specifies the selected status of the target component.
This API is deprecated since API version 9. You are advised to use [selected<sup>9+</sup>](#selected9). This API is deprecated since API version 9. You are advised to use [selected<sup>9+</sup>](#selected9) instead.
**System capability**: SystemCapability.Test.UiTest **System capability**: SystemCapability.Test.UiTest
...@@ -2937,7 +2938,7 @@ isBefore(by: By): By ...@@ -2937,7 +2938,7 @@ isBefore(by: By): By
Specifies that the target component is located before the given attribute component. Specifies that the target component is located before the given attribute component.
This API is deprecated since API version 9. You are advised to use [isBefore<sup>9+</sup>](#isbefore9). This API is deprecated since API version 9. You are advised to use [isBefore<sup>9+</sup>](#isbefore9) instead.
**System capability**: SystemCapability.Test.UiTest **System capability**: SystemCapability.Test.UiTest
...@@ -2992,7 +2993,7 @@ let by = BY.isAfter(BY.text('123')); // Use the static constructor BY to create ...@@ -2992,7 +2993,7 @@ let by = BY.isAfter(BY.text('123')); // Use the static constructor BY to create
In **UiTest**, the **UiComponent** class represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection. In **UiTest**, the **UiComponent** class represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection.
All APIs provided in this class use a promise to return the result and must be invoked using **await**. All APIs provided in this class use a promise to return the result and must be invoked using **await**.
This API is deprecated since API version 9. You are advised to use [Component<sup>9+</sup>](#component9) instead. This class is deprecated since API version 9. You are advised to use [Component<sup>9+</sup>](#component9) instead.
### click<sup>(deprecated)</sup> ### click<sup>(deprecated)</sup>
...@@ -3373,7 +3374,7 @@ async function demo() { ...@@ -3373,7 +3374,7 @@ async function demo() {
The **UiDriver** class is the main entry to the UiTest framework. It provides APIs for features such as component matching/search, key injection, coordinate clicking/sliding, and screenshot. The **UiDriver** class is the main entry to the UiTest framework. It provides APIs for features such as component matching/search, key injection, coordinate clicking/sliding, and screenshot.
All APIs provided by this class, except for **UiDriver.create()**, use a promise to return the result and must be invoked using **await**. All APIs provided by this class, except for **UiDriver.create()**, use a promise to return the result and must be invoked using **await**.
This API is deprecated since API version 9. You are advised to use [Driver<sup>9+</sup>](#driver9) instead. This class is deprecated since API version 9. You are advised to use [Driver<sup>9+</sup>](#driver9) instead.
### create<sup>(deprecated)</sup> ### create<sup>(deprecated)</sup>
......
# WLAN # @ohos.wifiManager (WLAN)
The **WLAN** module provides basic wireless local area network (WLAN) functions, peer-to-peer (P2P) functions, and WLAN message notification services. It allows applications to communicate with other devices over WLAN. The **WLAN** module provides basic wireless local area network (WLAN) functions, peer-to-peer (P2P) functions, and WLAN message notification services. It allows applications to communicate with other devices over WLAN.
> **NOTE** > **NOTE**
...@@ -31,6 +30,14 @@ Enables WLAN. ...@@ -31,6 +30,14 @@ Enables WLAN.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.disableWifi<sup>9+</sup> ## wifi.disableWifi<sup>9+</sup>
...@@ -50,6 +57,13 @@ Disables WLAN. ...@@ -50,6 +57,13 @@ Disables WLAN.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.isWifiActive<sup>9+</sup> ## wifi.isWifiActive<sup>9+</sup>
...@@ -67,6 +81,13 @@ Checks whether WLAN is enabled. ...@@ -67,6 +81,13 @@ Checks whether WLAN is enabled.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if WLAN is enabled; returns **false** otherwise.| | boolean | Returns **true** if WLAN is enabled; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.scan<sup>9+</sup> ## wifi.scan<sup>9+</sup>
...@@ -74,7 +95,7 @@ scan(): void ...@@ -74,7 +95,7 @@ scan(): void
Starts a scan for WLAN. Starts a scan for WLAN.
**Required permissions**: **ohos.permission.SET_WIFI_INFO** and **ohos.permission.LOCATION** **Required permissions**: ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.WiFi.STA **System capability**: SystemCapability.Communication.WiFi.STA
...@@ -84,6 +105,13 @@ Starts a scan for WLAN. ...@@ -84,6 +105,13 @@ Starts a scan for WLAN.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getScanResults<sup>9+</sup> ## wifi.getScanResults<sup>9+</sup>
...@@ -101,6 +129,13 @@ Obtains the scan result. This API uses a promise to return the result. ...@@ -101,6 +129,13 @@ Obtains the scan result. This API uses a promise to return the result.
| -------- | -------- | | -------- | -------- |
| Promise&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&nbsp;&gt; | Promise used to return the detected hotspots.| | Promise&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&nbsp;&gt; | Promise used to return the detected hotspots.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getScanResults<sup>9+</sup> ## wifi.getScanResults<sup>9+</sup>
...@@ -118,6 +153,14 @@ Obtains the scan result. This API uses an asynchronous callback to return the re ...@@ -118,6 +153,14 @@ Obtains the scan result. This API uses an asynchronous callback to return the re
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the detected hotspots. Otherwise, **err** is a non-zero value and **data** is empty.| | callback | AsyncCallback&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the detected hotspots. Otherwise, **err** is a non-zero value and **data** is empty.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
**Example** **Example**
```js ```js
import wifi from '@ohos.wifi'; import wifi from '@ohos.wifi';
...@@ -251,6 +294,13 @@ Obtains the scan result. This API returns the result synchronously. ...@@ -251,6 +294,13 @@ Obtains the scan result. This API returns the result synchronously.
| -------- | -------- | | -------- | -------- |
| &nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt; | Scan result obtained.| | &nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt; | Scan result obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.addDeviceConfig<sup>9+</sup> ## wifi.addDeviceConfig<sup>9+</sup>
...@@ -276,6 +326,14 @@ Adds network configuration. This API uses a promise to return the result. ...@@ -276,6 +326,14 @@ Adds network configuration. This API uses a promise to return the result.
| -------- | -------- | | -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the ID of the added network configuration. If **-1** is returned, the network configuration fails to be added.| | Promise&lt;number&gt; | Promise used to return the ID of the added network configuration. If **-1** is returned, the network configuration fails to be added.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## WifiDeviceConfig<sup>9+</sup> ## WifiDeviceConfig<sup>9+</sup>
Represents the WLAN configuration. Represents the WLAN configuration.
...@@ -351,6 +409,8 @@ Represents EAP configuration information. ...@@ -351,6 +409,8 @@ Represents EAP configuration information.
| caCertAliases | string | Yes| No| CA certificate alias.| | caCertAliases | string | Yes| No| CA certificate alias.|
| caPath | string | Yes| No| CA certificate path.| | caPath | string | Yes| No| CA certificate path.|
| clientCertAliases | string | Yes| No| Client certificate alias.| | clientCertAliases | string | Yes| No| Client certificate alias.|
| certEntry | Uint8Array | Yes| Yes| CA certificate content.|
| certPassword | string | Yes| Yes| CA certificate password.|
| altSubjectMatch | string | Yes| No| A string to match the alternate subject.| | altSubjectMatch | string | Yes| No| A string to match the alternate subject.|
| domainSuffixMatch | string | Yes| No| A string to match the domain suffix.| | domainSuffixMatch | string | Yes| No| A string to match the domain suffix.|
| realm | string | Yes| No| Realm for the passpoint credential.| | realm | string | Yes| No| Realm for the passpoint credential.|
...@@ -418,6 +478,13 @@ Adds network configuration. This API uses an asynchronous callback to return the ...@@ -418,6 +478,13 @@ Adds network configuration. This API uses an asynchronous callback to return the
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.| | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.| | callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.addCandidateConfig<sup>9+</sup> ## wifi.addCandidateConfig<sup>9+</sup>
...@@ -441,6 +508,13 @@ Adds the configuration of a candidate network. This API uses a promise to return ...@@ -441,6 +508,13 @@ Adds the configuration of a candidate network. This API uses a promise to return
| -------- | -------- | | -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the network configuration ID.| | Promise&lt;number&gt; | Promise used to return the network configuration ID.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.addCandidateConfig<sup>9+</sup> ## wifi.addCandidateConfig<sup>9+</sup>
...@@ -459,6 +533,13 @@ Adds the configuration of a candidate network. This API uses an asynchronous cal ...@@ -459,6 +533,13 @@ Adds the configuration of a candidate network. This API uses an asynchronous cal
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.| | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.| | callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.removeCandidateConfig<sup>9+</sup> ## wifi.removeCandidateConfig<sup>9+</sup>
...@@ -482,6 +563,13 @@ Removes the configuration of a candidate network. This API uses a promise to ret ...@@ -482,6 +563,13 @@ Removes the configuration of a candidate network. This API uses a promise to ret
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.removeCandidateConfig<sup>9+</sup> ## wifi.removeCandidateConfig<sup>9+</sup>
...@@ -500,6 +588,13 @@ Removes the configuration of a candidate network. This API uses an asynchronous ...@@ -500,6 +588,13 @@ Removes the configuration of a candidate network. This API uses an asynchronous
| networkId | number | Yes| ID of the network configuration to remove.| | networkId | number | Yes| ID of the network configuration to remove.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the operation is successful, the value of **err** is **0**. If **err** is not **0**, an error has occurred.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the operation is successful, the value of **err** is **0**. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getCandidateConfigs<sup>9+</sup> ## wifi.getCandidateConfigs<sup>9+</sup>
...@@ -517,6 +612,13 @@ Obtains candidate network configuration. ...@@ -517,6 +612,13 @@ Obtains candidate network configuration.
| -------- | -------- | | -------- | -------- |
| &nbsp;Array&lt;[WifiDeviceConfig](#wifideviceconfig)&gt; | Candidate network configuration obtained.| | &nbsp;Array&lt;[WifiDeviceConfig](#wifideviceconfig)&gt; | Candidate network configuration obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.connectToCandidateConfig<sup>9+</sup> ## wifi.connectToCandidateConfig<sup>9+</sup>
...@@ -534,6 +636,14 @@ Connects to a candidate network. ...@@ -534,6 +636,14 @@ Connects to a candidate network.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| networkId | number | Yes| ID of the candidate network configuration.| | networkId | number | Yes| ID of the candidate network configuration.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.connectToNetwork<sup>9+</sup> ## wifi.connectToNetwork<sup>9+</sup>
...@@ -553,12 +663,14 @@ Connects to the specified network. ...@@ -553,12 +663,14 @@ Connects to the specified network.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| networkId | number | Yes| Network configuration ID.| | networkId | number | Yes| Network configuration ID.|
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.connectToDevice<sup>9+</sup> ## wifi.connectToDevice<sup>9+</sup>
...@@ -579,12 +691,14 @@ Connects to the specified network. ...@@ -579,12 +691,14 @@ Connects to the specified network.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration.| | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration.|
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.disconnect<sup>9+</sup> ## wifi.disconnect<sup>9+</sup>
...@@ -599,12 +713,13 @@ Disconnects the network. ...@@ -599,12 +713,13 @@ Disconnects the network.
**System capability**: **System capability**:
SystemCapability.Communication.WiFi.STA SystemCapability.Communication.WiFi.STA
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getSignalLevel<sup>9+</sup> ## wifi.getSignalLevel<sup>9+</sup>
...@@ -629,6 +744,13 @@ Obtains the WLAN signal level. ...@@ -629,6 +744,13 @@ Obtains the WLAN signal level.
| -------- | -------- | | -------- | -------- |
| number | Signal level obtained. The value range is [0, 4].| | number | Signal level obtained. The value range is [0, 4].|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getLinkedInfo<sup>9+</sup> ## wifi.getLinkedInfo<sup>9+</sup>
...@@ -646,6 +768,14 @@ Obtains WLAN connection information. This API uses a promise to return the resul ...@@ -646,6 +768,14 @@ Obtains WLAN connection information. This API uses a promise to return the resul
| -------- | -------- | | -------- | -------- |
| Promise&lt;[WifiLinkedInfo](#wifilinkedinfo)&gt; | Promise used to return the WLAN connection information obtained.| | Promise&lt;[WifiLinkedInfo](#wifilinkedinfo)&gt; | Promise used to return the WLAN connection information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.getLinkedInfo<sup>9+</sup> ## wifi.getLinkedInfo<sup>9+</sup>
...@@ -663,6 +793,15 @@ Obtains WLAN connection information. This API uses an asynchronous callback to r ...@@ -663,6 +793,15 @@ Obtains WLAN connection information. This API uses an asynchronous callback to r
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiLinkedInfo](#wifilinkedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the WLAN connection information obtained. If **err** is not **0**, an error has occurred.| | callback | AsyncCallback&lt;[WifiLinkedInfo](#wifilinkedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the WLAN connection information obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
**Example** **Example**
```js ```js
import wifi from '@ohos.wifi'; import wifi from '@ohos.wifi';
...@@ -767,6 +906,13 @@ Checks whether the WLAN is connected. ...@@ -767,6 +906,13 @@ Checks whether the WLAN is connected.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.| | boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getSupportedFeatures<sup>9+</sup> ## wifi.getSupportedFeatures<sup>9+</sup>
...@@ -795,12 +941,19 @@ Obtains the features supported by this device. ...@@ -795,12 +941,19 @@ Obtains the features supported by this device.
| 0x0004 | Generic Advertisement Service (GAS)/Access Network Query Protocol (ANQP) feature| | 0x0004 | Generic Advertisement Service (GAS)/Access Network Query Protocol (ANQP) feature|
| 0x0008 | Wi-Fi Direct| | 0x0008 | Wi-Fi Direct|
| 0x0010 | SoftAP| | 0x0010 | SoftAP|
| 0x0040 | Wi-Fi AWare| | 0x0040 | Wi-Fi Aware|
| 0x8000 | WLAN AP/STA concurrency| | 0x8000 | WLAN AP/STA concurrency|
| 0x8000000 | WPA3 Personal (WPA-3 SAE)| | 0x8000000 | WPA3 Personal (WPA-3 SAE)|
| 0x10000000 | WPA3-Enterprise Suite B | | 0x10000000 | WPA3-Enterprise Suite B |
| 0x20000000 | Enhanced open feature| | 0x20000000 | Enhanced open feature|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2401000 | Operation failed.|
## wifi.isFeatureSupported<sup>9+</sup> ## wifi.isFeatureSupported<sup>9+</sup>
...@@ -825,6 +978,13 @@ Checks whether the device supports the specified WLAN feature. ...@@ -825,6 +978,13 @@ Checks whether the device supports the specified WLAN feature.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the feature is supported; returns **false** otherwise.| | boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2401000 | Operation failed.|
## wifi.getDeviceMacAddress<sup>9+</sup> ## wifi.getDeviceMacAddress<sup>9+</sup>
...@@ -844,6 +1004,13 @@ Obtains the device MAC address. ...@@ -844,6 +1004,13 @@ Obtains the device MAC address.
| -------- | -------- | | -------- | -------- |
| string[] | MAC address obtained.| | string[] | MAC address obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getIpInfo<sup>9+</sup> ## wifi.getIpInfo<sup>9+</sup>
...@@ -861,6 +1028,13 @@ Obtains IP information. ...@@ -861,6 +1028,13 @@ Obtains IP information.
| -------- | -------- | | -------- | -------- |
| [IpInfo](#ipinfo9) | IP information obtained.| | [IpInfo](#ipinfo9) | IP information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## IpInfo<sup>9+</sup> ## IpInfo<sup>9+</sup>
...@@ -895,6 +1069,13 @@ Obtains the country code. ...@@ -895,6 +1069,13 @@ Obtains the country code.
| -------- | -------- | | -------- | -------- |
| string | Country code obtained.| | string | Country code obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2401000 | Operation failed.|
## wifi.reassociate<sup>9+</sup> ## wifi.reassociate<sup>9+</sup>
...@@ -908,12 +1089,14 @@ Re-associates with the network. ...@@ -908,12 +1089,14 @@ Re-associates with the network.
**System capability**: SystemCapability.Communication.WiFi.STA **System capability**: SystemCapability.Communication.WiFi.STA
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.reconnect<sup>9+</sup> ## wifi.reconnect<sup>9+</sup>
...@@ -927,12 +1110,14 @@ Reconnects to the network. ...@@ -927,12 +1110,14 @@ Reconnects to the network.
**System capability**: SystemCapability.Communication.WiFi.STA **System capability**: SystemCapability.Communication.WiFi.STA
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.getDeviceConfigs<sup>9+</sup> ## wifi.getDeviceConfigs<sup>9+</sup>
...@@ -952,6 +1137,13 @@ Obtains network configuration. ...@@ -952,6 +1137,13 @@ Obtains network configuration.
| -------- | -------- | | -------- | -------- |
| &nbsp;Array&lt;[WifiDeviceConfig](#wifideviceconfig)&gt; | Array of network configuration obtained.| | &nbsp;Array&lt;[WifiDeviceConfig](#wifideviceconfig)&gt; | Array of network configuration obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.updateNetwork<sup>9+</sup> ## wifi.updateNetwork<sup>9+</sup>
...@@ -977,6 +1169,13 @@ Updates network configuration. ...@@ -977,6 +1169,13 @@ Updates network configuration.
| -------- | -------- | | -------- | -------- |
| number | ID of the updated network configuration. The value **-1** indicates that the operation has failed.| | number | ID of the updated network configuration. The value **-1** indicates that the operation has failed.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.disableNetwork<sup>9+</sup> ## wifi.disableNetwork<sup>9+</sup>
...@@ -996,12 +1195,13 @@ Disables network configuration. ...@@ -996,12 +1195,13 @@ Disables network configuration.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| netId | number | Yes| ID of the network configuration to disable.| | netId | number | Yes| ID of the network configuration to disable.|
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.removeAllNetwork<sup>9+</sup> ## wifi.removeAllNetwork<sup>9+</sup>
...@@ -1015,12 +1215,13 @@ Removes the configuration of all networks. ...@@ -1015,12 +1215,13 @@ Removes the configuration of all networks.
**System capability**: SystemCapability.Communication.WiFi.STA **System capability**: SystemCapability.Communication.WiFi.STA
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.removeDevice<sup>9+</sup> ## wifi.removeDevice<sup>9+</sup>
...@@ -1038,14 +1239,15 @@ Removes the specified network configuration. ...@@ -1038,14 +1239,15 @@ Removes the specified network configuration.
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| id | number | Yes| ID of the network configuration to remove.| | id | number | Yes| ID of the network configuration to remove.|
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.enableHotspot<sup>9+</sup> ## wifi.enableHotspot<sup>9+</sup>
...@@ -1059,12 +1261,13 @@ Enables this hotspot. ...@@ -1059,12 +1261,13 @@ Enables this hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Core **System capability**: SystemCapability.Communication.WiFi.AP.Core
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.disableHotspot<sup>9+</sup> ## wifi.disableHotspot<sup>9+</sup>
...@@ -1078,12 +1281,13 @@ Disables this hotspot. ...@@ -1078,12 +1281,13 @@ Disables this hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Core **System capability**: SystemCapability.Communication.WiFi.AP.Core
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.isHotspotDualBandSupported<sup>9+</sup> ## wifi.isHotspotDualBandSupported<sup>9+</sup>
...@@ -1103,6 +1307,13 @@ Checks whether the hotspot supports dual band. ...@@ -1103,6 +1307,13 @@ Checks whether the hotspot supports dual band.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the feature is supported; returns **false** otherwise.| | boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.isHotspotActive<sup>9+</sup> ## wifi.isHotspotActive<sup>9+</sup>
...@@ -1122,6 +1333,13 @@ Checks whether this hotspot is active. ...@@ -1122,6 +1333,13 @@ Checks whether this hotspot is active.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the hotspot is active; returns **false** otherwise.| | boolean | Returns **true** if the hotspot is active; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.setHotspotConfig<sup>9+</sup> ## wifi.setHotspotConfig<sup>9+</sup>
...@@ -1141,12 +1359,13 @@ Sets hotspot configuration. ...@@ -1141,12 +1359,13 @@ Sets hotspot configuration.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [HotspotConfig](#hotspotconfig9) | Yes| Hotspot configuration to set.| | config | [HotspotConfig](#hotspotconfig9) | Yes| Hotspot configuration to set.|
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## HotspotConfig<sup>9+</sup> ## HotspotConfig<sup>9+</sup>
...@@ -1169,7 +1388,7 @@ Represents the hotspot configuration. ...@@ -1169,7 +1388,7 @@ Represents the hotspot configuration.
getHotspotConfig(): HotspotConfig getHotspotConfig(): HotspotConfig
obtains hotspot configuration. Obtains hotspot configuration.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -1183,6 +1402,13 @@ obtains hotspot configuration. ...@@ -1183,6 +1402,13 @@ obtains hotspot configuration.
| -------- | -------- | | -------- | -------- |
| [HotspotConfig](#hotspotconfig9) | Hotspot configuration obtained.| | [HotspotConfig](#hotspotconfig9) | Hotspot configuration obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.getStations<sup>9+</sup> ## wifi.getStations<sup>9+</sup>
...@@ -1202,6 +1428,13 @@ Obtains information about the connected stations. ...@@ -1202,6 +1428,13 @@ Obtains information about the connected stations.
| -------- | -------- | | -------- | -------- |
| &nbsp;Array&lt;[StationInfo](#stationinfo9)&gt; | Connected stations obtained.| | &nbsp;Array&lt;[StationInfo](#stationinfo9)&gt; | Connected stations obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## StationInfo<sup>9+</sup> ## StationInfo<sup>9+</sup>
...@@ -1234,7 +1467,13 @@ Obtains P2P link information. This API uses a promise to return the result. ...@@ -1234,7 +1467,13 @@ Obtains P2P link information. This API uses a promise to return the result.
| -------- | -------- | | -------- | -------- |
| Promise&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | Promise used to return the P2P link information obtained.| | Promise&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | Promise used to return the P2P link information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## WifiP2pLinkedInfo<sup>9+</sup> ## WifiP2pLinkedInfo<sup>9+</sup>
...@@ -1294,6 +1533,13 @@ Obtains the current P2P group information. This API uses a promise to return the ...@@ -1294,6 +1533,13 @@ Obtains the current P2P group information. This API uses a promise to return the
| -------- | -------- | | -------- | -------- |
| Promise&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt; | Promise used to return the P2P group information obtained.| | Promise&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt; | Promise used to return the P2P group information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getCurrentGroup<sup>9+</sup> ## wifi.getCurrentGroup<sup>9+</sup>
...@@ -1311,6 +1557,13 @@ Obtains the current P2P group information. This API uses an asynchronous callbac ...@@ -1311,6 +1557,13 @@ Obtains the current P2P group information. This API uses an asynchronous callbac
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.| | callback | AsyncCallback&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getP2pPeerDevices<sup>9+</sup> ## wifi.getP2pPeerDevices<sup>9+</sup>
...@@ -1328,6 +1581,13 @@ Obtains the peer device list in the P2P connection. This API uses a promise to r ...@@ -1328,6 +1581,13 @@ Obtains the peer device list in the P2P connection. This API uses a promise to r
| -------- | -------- | | -------- | -------- |
| Promise&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | Promise used to return the peer device list.| | Promise&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | Promise used to return the peer device list.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getP2pPeerDevices<sup>9+</sup> ## wifi.getP2pPeerDevices<sup>9+</sup>
...@@ -1345,6 +1605,13 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou ...@@ -1345,6 +1605,13 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the peer device list obtained. If **err** is not **0**, an error has occurred.| | callback | AsyncCallback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the peer device list obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## WifiP2pDevice<sup>9+</sup> ## WifiP2pDevice<sup>9+</sup>
...@@ -1392,6 +1659,13 @@ Obtains the local device information in the P2P connection. This API uses a prom ...@@ -1392,6 +1659,13 @@ Obtains the local device information in the P2P connection. This API uses a prom
| -------- | -------- | | -------- | -------- |
| Promise&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | Promise used to return the local device information obtained.| | Promise&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | Promise used to return the local device information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getP2pLocalDevice<sup>9+</sup> ## wifi.getP2pLocalDevice<sup>9+</sup>
...@@ -1426,12 +1700,13 @@ Creates a P2P group. ...@@ -1426,12 +1700,13 @@ Creates a P2P group.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| Group configuration.| | config | [WifiP2PConfig](#wifip2pconfig9) | Yes| Group configuration.|
**Return value** **Error codes**
| Type| Description| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## WifiP2PConfig<sup>9+</sup> ## WifiP2PConfig<sup>9+</sup>
...@@ -1471,12 +1746,13 @@ Removes this P2P group. ...@@ -1471,12 +1746,13 @@ Removes this P2P group.
**System capability**: SystemCapability.Communication.WiFi.P2P **System capability**: SystemCapability.Communication.WiFi.P2P
**Return value** **Error codes**
| Type| Description| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.p2pConnect<sup>9+</sup> ## wifi.p2pConnect<sup>9+</sup>
...@@ -1495,12 +1771,13 @@ Sets up a P2P connection. ...@@ -1495,12 +1771,13 @@ Sets up a P2P connection.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| P2P group configuration.| | config | [WifiP2PConfig](#wifip2pconfig9) | Yes| P2P group configuration.|
**Return value** **Error codes**
| Type| Description| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
**Example** **Example**
```js ```js
...@@ -1579,12 +1856,13 @@ Cancels this P2P connection. ...@@ -1579,12 +1856,13 @@ Cancels this P2P connection.
**System capability**: SystemCapability.Communication.WiFi.P2P **System capability**: SystemCapability.Communication.WiFi.P2P
**Return value** **Error codes**
| Type| Description| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.startDiscoverDevices<sup>9+</sup> ## wifi.startDiscoverDevices<sup>9+</sup>
...@@ -1596,12 +1874,13 @@ Starts to discover devices. ...@@ -1596,12 +1874,13 @@ Starts to discover devices.
**System capability**: SystemCapability.Communication.WiFi.P2P **System capability**: SystemCapability.Communication.WiFi.P2P
**Return value** **Error codes**
| Type| Description| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.stopDiscoverDevices<sup>9+</sup> ## wifi.stopDiscoverDevices<sup>9+</sup>
...@@ -1613,12 +1892,13 @@ Stops discovering devices. ...@@ -1613,12 +1892,13 @@ Stops discovering devices.
**System capability**: SystemCapability.Communication.WiFi.P2P **System capability**: SystemCapability.Communication.WiFi.P2P
**Return value** **Error codes**
| Type| Description| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.deletePersistentGroup<sup>9+</sup> ## wifi.deletePersistentGroup<sup>9+</sup>
...@@ -1639,12 +1919,13 @@ Deletes a persistent group. ...@@ -1639,12 +1919,13 @@ Deletes a persistent group.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| netId | number | Yes| ID of the group to delete.| | netId | number | Yes| ID of the group to delete.|
**Return value** **Error codes**
| Type| Description| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getP2pGroups<sup>9+</sup> ## wifi.getP2pGroups<sup>9+</sup>
...@@ -1664,6 +1945,13 @@ Obtains information about all P2P groups. This API uses a promise to return the ...@@ -1664,6 +1945,13 @@ Obtains information about all P2P groups. This API uses a promise to return the
| -------- | -------- | | -------- | -------- |
| Promise&lt;&nbsp;Array&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt;&nbsp;&gt; | Promise used to return the group information obtained.| | Promise&lt;&nbsp;Array&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt;&nbsp;&gt; | Promise used to return the group information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## WifiP2pGroupInfo<sup>9+</sup> ## WifiP2pGroupInfo<sup>9+</sup>
...@@ -1702,6 +1990,13 @@ Obtains information about all P2P groups. This API uses an asynchronous callback ...@@ -1702,6 +1990,13 @@ Obtains information about all P2P groups. This API uses an asynchronous callback
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;&nbsp;Array&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.| | callback | AsyncCallback&lt;&nbsp;Array&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.setDeviceName<sup>9+</sup> ## wifi.setDeviceName<sup>9+</sup>
...@@ -1721,12 +2016,13 @@ Sets the device name. ...@@ -1721,12 +2016,13 @@ Sets the device name.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| devName | string | Yes| Device name to set.| | devName | string | Yes| Device name to set.|
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('wifiStateChange')<sup>9+</sup> ## wifi.on('wifiStateChange')<sup>9+</sup>
...@@ -1745,6 +2041,14 @@ Registers the WLAN state change events. ...@@ -1745,6 +2041,14 @@ Registers the WLAN state change events.
| type | string | Yes| Event type. The value is **wifiStateChange**.| | type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the WLAN state.| | callback | Callback&lt;number&gt; | Yes| Callback invoked to return the WLAN state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
**WLAN states** **WLAN states**
| **Value**| **Description**| | **Value**| **Description**|
...@@ -1772,6 +2076,14 @@ Unregisters the WLAN state change events. ...@@ -1772,6 +2076,14 @@ Unregisters the WLAN state change events.
| type | string | Yes| Event type. The value is **wifiStateChange**.| | type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;number&gt; | No| Callback for the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
**Example** **Example**
```js ```js
import wifi from '@ohos.wifi'; import wifi from '@ohos.wifi';
...@@ -1788,7 +2100,7 @@ Unregisters the WLAN state change events. ...@@ -1788,7 +2100,7 @@ Unregisters the WLAN state change events.
``` ```
## wifi.on('wifiConnectionChange')<sup>7+</sup> ## wifi.on('wifiConnectionChange')<sup>9+</sup>
on(type: "wifiConnectionChange", callback: Callback&lt;number&gt;): void on(type: "wifiConnectionChange", callback: Callback&lt;number&gt;): void
...@@ -1812,6 +2124,13 @@ Registers the WLAN connection state change events. ...@@ -1812,6 +2124,13 @@ Registers the WLAN connection state change events.
| 0 | Disconnected.| | 0 | Disconnected.|
| 1 | Connected.| | 1 | Connected.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.off('wifiConnectionChange')<sup>9+</sup> ## wifi.off('wifiConnectionChange')<sup>9+</sup>
...@@ -1830,6 +2149,13 @@ Unregisters the WLAN connection state change events. ...@@ -1830,6 +2149,13 @@ Unregisters the WLAN connection state change events.
| type | string | Yes| Event type. The value is **wifiConnectionChange**.| | type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;number&gt; | No| Callback for the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.on('wifiScanStateChange')<sup>9+</sup> ## wifi.on('wifiScanStateChange')<sup>9+</sup>
...@@ -1855,6 +2181,13 @@ Registers the WLAN scan state change events. ...@@ -1855,6 +2181,13 @@ Registers the WLAN scan state change events.
| 0 | Scan failed.| | 0 | Scan failed.|
| 1 | Scan successful.| | 1 | Scan successful.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.off('wifiScanStateChange')<sup>9+</sup> ## wifi.off('wifiScanStateChange')<sup>9+</sup>
...@@ -1873,6 +2206,13 @@ Unregisters the WLAN scan state change events. ...@@ -1873,6 +2206,13 @@ Unregisters the WLAN scan state change events.
| type | string | Yes| Event type. The value is **wifiScanStateChange**.| | type | string | Yes| Event type. The value is **wifiScanStateChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the WLAN scan state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;number&gt; | No| Callback for the WLAN scan state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.on('wifiRssiChange')<sup>9+</sup> ## wifi.on('wifiRssiChange')<sup>9+</sup>
...@@ -1891,6 +2231,13 @@ Registers the RSSI change events. ...@@ -1891,6 +2231,13 @@ Registers the RSSI change events.
| type | string | Yes| Event type. The value is **wifiRssiChange**.| | type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the RSSI, in dBm.| | callback | Callback&lt;number&gt; | Yes| Callback invoked to return the RSSI, in dBm.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.off('wifiRssiChange')<sup>9+</sup> ## wifi.off('wifiRssiChange')<sup>9+</sup>
...@@ -1909,6 +2256,13 @@ Unregisters the RSSI change events. ...@@ -1909,6 +2256,13 @@ Unregisters the RSSI change events.
| type | string | Yes| Event type. The value is **wifiRssiChange**.| | type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the RSSI. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;number&gt; | No| Callback for the RSSI. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.on('hotspotStateChange')<sup>9+</sup> ## wifi.on('hotspotStateChange')<sup>9+</sup>
...@@ -1936,6 +2290,13 @@ Registers the hotspot state change events. ...@@ -1936,6 +2290,13 @@ Registers the hotspot state change events.
| 2 | Activating| | 2 | Activating|
| 3 | Deactivating| | 3 | Deactivating|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.off('hotspotStateChange')<sup>9+</sup> ## wifi.off('hotspotStateChange')<sup>9+</sup>
...@@ -1954,6 +2315,13 @@ Unregisters the hotspot state change events. ...@@ -1954,6 +2315,13 @@ Unregisters the hotspot state change events.
| type | string | Yes| Event type. The value is **hotspotStateChange**.| | type | string | Yes| Event type. The value is **hotspotStateChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;number&gt; | No| Callback for the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.on('p2pStateChange')<sup>9+</sup> ## wifi.on('p2pStateChange')<sup>9+</sup>
...@@ -1982,6 +2350,14 @@ Registers the P2P state change events. ...@@ -1982,6 +2350,14 @@ Registers the P2P state change events.
| 4 | Closing| | 4 | Closing|
| 5 | Closed| | 5 | Closed|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pStateChange')<sup>9+</sup> ## wifi.off('p2pStateChange')<sup>9+</sup>
off(type: "p2pStateChange", callback?: Callback&lt;number&gt;): void off(type: "p2pStateChange", callback?: Callback&lt;number&gt;): void
...@@ -1999,6 +2375,13 @@ Unregisters the P2P state change events. ...@@ -1999,6 +2375,13 @@ Unregisters the P2P state change events.
| type | string | Yes| Event type. The value is **p2pStateChange**.| | type | string | Yes| Event type. The value is **p2pStateChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;number&gt; | No| Callback for the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pConnectionChange')<sup>9+</sup> ## wifi.on('p2pConnectionChange')<sup>9+</sup>
...@@ -2017,6 +2400,13 @@ Registers the P2P connection state change events. ...@@ -2017,6 +2400,13 @@ Registers the P2P connection state change events.
| type | string | Yes| Event type. The value is **p2pConnectionChange**.| | type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| callback | Callback&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | Yes| Callback invoked to return the P2P connection state.| | callback | Callback&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | Yes| Callback invoked to return the P2P connection state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pConnectionChange')<sup>9+</sup> ## wifi.off('p2pConnectionChange')<sup>9+</sup>
...@@ -2035,6 +2425,13 @@ Unregisters the P2P connection state change events. ...@@ -2035,6 +2425,13 @@ Unregisters the P2P connection state change events.
| type | string | Yes| Event type. The value is **p2pConnectionChange**.| | type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| callback | Callback&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | No| Callback for the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | No| Callback for the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pDeviceChange')<sup>9+</sup> ## wifi.on('p2pDeviceChange')<sup>9+</sup>
...@@ -2053,6 +2450,13 @@ Registers the P2P device state change events. ...@@ -2053,6 +2450,13 @@ Registers the P2P device state change events.
| type | string | Yes| Event type. The value is **p2pDeviceChange**.| | type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| callback | Callback&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | Yes| Callback invoked to return the P2P device state.| | callback | Callback&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | Yes| Callback invoked to return the P2P device state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pDeviceChange')<sup>9+</sup> ## wifi.off('p2pDeviceChange')<sup>9+</sup>
...@@ -2071,6 +2475,13 @@ Unregisters the P2P device state change events. ...@@ -2071,6 +2475,13 @@ Unregisters the P2P device state change events.
| type | string | Yes| Event type. The value is **p2pDeviceChange**.| | type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| callback | Callback&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | No| Callback for the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | No| Callback for the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pPeerDeviceChange')<sup>9+</sup> ## wifi.on('p2pPeerDeviceChange')<sup>9+</sup>
...@@ -2089,6 +2500,13 @@ Registers the P2P peer device state change events. ...@@ -2089,6 +2500,13 @@ Registers the P2P peer device state change events.
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | Yes| Callback invoked to return the P2P peer device state.| | callback | Callback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | Yes| Callback invoked to return the P2P peer device state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pPeerDeviceChange')<sup>9+</sup> ## wifi.off('p2pPeerDeviceChange')<sup>9+</sup>
...@@ -2107,6 +2525,13 @@ Unregisters the P2P peer device state change events. ...@@ -2107,6 +2525,13 @@ Unregisters the P2P peer device state change events.
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | No| Callback for the peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | No| Callback for the peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pPersistentGroupChange')<sup>9+</sup> ## wifi.on('p2pPersistentGroupChange')<sup>9+</sup>
...@@ -2125,6 +2550,13 @@ Registers the P2P persistent group state change events. ...@@ -2125,6 +2550,13 @@ Registers the P2P persistent group state change events.
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| callback | Callback&lt;void&gt; | Yes| Callback invoked to return the P2P persistent group state.| | callback | Callback&lt;void&gt; | Yes| Callback invoked to return the P2P persistent group state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pPersistentGroupChange')<sup>9+</sup> ## wifi.off('p2pPersistentGroupChange')<sup>9+</sup>
...@@ -2143,6 +2575,13 @@ Unregisters the P2P persistent group state change events. ...@@ -2143,6 +2575,13 @@ Unregisters the P2P persistent group state change events.
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| callback | Callback&lt;void&gt; | No| Callback for the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;void&gt; | No| Callback for the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pDiscoveryChange')<sup>9+</sup> ## wifi.on('p2pDiscoveryChange')<sup>9+</sup>
...@@ -2168,6 +2607,13 @@ Registers the P2P device discovery state change events. ...@@ -2168,6 +2607,13 @@ Registers the P2P device discovery state change events.
| 0 | Initial state.| | 0 | Initial state.|
| 1 | Discovered.| | 1 | Discovered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pDiscoveryChange')<sup>9+</sup> ## wifi.off('p2pDiscoveryChange')<sup>9+</sup>
...@@ -2185,3 +2631,11 @@ Unregisters the P2P device discovery state change events. ...@@ -2185,3 +2631,11 @@ Unregisters the P2P device discovery state change events.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.| | type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the P2P device discovery state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;number&gt; | No| Callback for the P2P device discovery state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
# WLAN Extension Interface # @ohos.wifiManagerExt (WLAN Extension)
This **wifiext** module provides WLAN extension interfaces for non-universal products. This **wifiext** module provides WLAN extension interfaces for non-universal products.
> **NOTE** > **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.
The APIs described in this document are used only for non-universal products, such as routers. > - The APIs described in this document are used only for non-universal products, such as routers.
## Modules to Import ## Modules to Import
...@@ -14,9 +14,9 @@ The APIs described in this document are used only for non-universal products, su ...@@ -14,9 +14,9 @@ The APIs described in this document are used only for non-universal products, su
import wifiManagerExt from '@ohos.wifiManagerExt'; import wifiManagerExt from '@ohos.wifiManagerExt';
``` ```
## wifiext.enableHotspot ## wifiext.enableHotspot<sup>9+</sup>
enableHotspot(): boolean; enableHotspot(): void;
Enables the WLAN hotspot. Enables the WLAN hotspot.
...@@ -24,16 +24,17 @@ Enables the WLAN hotspot. ...@@ -24,16 +24,17 @@ Enables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension **System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.disableHotspot ## wifiext.disableHotspot<sup>9+</sup>
disableHotspot(): boolean; disableHotspot(): void;
Disables the WLAN hotspot. Disables the WLAN hotspot.
...@@ -41,18 +42,19 @@ Disables the WLAN hotspot. ...@@ -41,18 +42,19 @@ Disables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension **System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value** **Error codes**
| **Type**| **Description**| For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.getSupportedPowerModel ## wifiext.getSupportedPowerMode<sup>9+</sup>
getSupportedPowerModel(): Promise&lt;Array&lt;PowerModel&gt;&gt; getSupportedPowerMode(): Promise&lt;Array&lt;PowerMode&gt;&gt;
Obtains the supported power models. This API uses a promise to return the result. Obtains the supported power modes. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_WIFI_INFO **Required permissions**: ohos.permission.GET_WIFI_INFO
...@@ -60,14 +62,21 @@ Obtains the supported power models. This API uses a promise to return the result ...@@ -60,14 +62,21 @@ Obtains the supported power models. This API uses a promise to return the result
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Promise used to return the power models obtained.| | Promise&lt;Array&lt;[PowerMode](#powermode)&gt;&gt; | Promise used to return the power modes obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
## PowerModel | **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
Enumerates the power models. ## PowerMode
Enumerates the power modes.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension **System capability**: SystemCapability.Communication.WiFi.AP.Extension
...@@ -78,11 +87,11 @@ Enumerates the power models. ...@@ -78,11 +87,11 @@ Enumerates the power models.
| THROUGH_WALL | 2 | Through_wall| | THROUGH_WALL | 2 | Through_wall|
## wifiext.getSupportedPowerModel ## wifiext.getSupportedPowerMode<sup>9+</sup>
getSupportedPowerModel(callback: AsyncCallback&lt;Array&lt;PowerModel&gt;&gt;): void getSupportedPowerMode(callback: AsyncCallback&lt;Array&lt;PowerMode&gt;&gt;): void
Obtains the supported power models. This API uses an asynchronous callback to return the result. Obtains the supported power modes. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_WIFI_INFO **Required permissions**: ohos.permission.GET_WIFI_INFO
...@@ -90,16 +99,23 @@ Obtains the supported power models. This API uses an asynchronous callback to re ...@@ -90,16 +99,23 @@ Obtains the supported power models. This API uses an asynchronous callback to re
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is 0 and **data** is the power models obtained. If **err** is not **0**, an error has occurred.| | callback | AsyncCallback&lt;Array&lt;[PowerMode](#powermode)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power modes obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.getPowerModel ## wifiext.getPowerMode<sup>9+</sup>
getPowerModel(): Promise&lt;PowerModel&gt; getPowerMode(): Promise&lt;PowerMode&gt;
Obtains the power model. This API uses a promise to return the result. Obtains the power mode. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_WIFI_INFO **Required permissions**: ohos.permission.GET_WIFI_INFO
...@@ -107,16 +123,23 @@ Obtains the power model. This API uses a promise to return the result. ...@@ -107,16 +123,23 @@ Obtains the power model. This API uses a promise to return the result.
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[PowerModel](#powermodel)&gt; | Promise used to return the power model obtained.| | Promise&lt;[PowerMode](#powermode)&gt; | Promise used to return the power modes obtained.|
**Error codes**
## wifiext.getPowerModel For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
getPowerModel(callback: AsyncCallback&lt;PowerModel&gt;): void | **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
Obtains the power model. This API uses an asynchronous callback to return the result. ## wifiext.getPowerMode<sup>9+</sup>
getPowerMode(callback: AsyncCallback&lt;PowerMode&gt;): void
Obtains the power mode. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_WIFI_INFO **Required permissions**: ohos.permission.GET_WIFI_INFO
...@@ -124,16 +147,23 @@ Obtains the power model. This API uses an asynchronous callback to return the re ...@@ -124,16 +147,23 @@ Obtains the power model. This API uses an asynchronous callback to return the re
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power model obtained. If **err** is not **0**, an error has occurred.| | callback | AsyncCallback&lt;[PowerMode](#powermode)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power mode obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
## wifiext.setPowerModel | **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
setPowerModel(model: PowerModel) : boolean; ## wifiext.setPowerMode<sup>9+</sup>
Sets the power model. setPowerMode(model: PowerMode) : boolean;
Sets the power mode.
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT **Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
...@@ -141,12 +171,14 @@ setPowerModel(model: PowerModel) : boolean; ...@@ -141,12 +171,14 @@ setPowerModel(model: PowerModel) : boolean;
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| model | [PowerModel](#powermodel) | Yes| Power model to set.| | model | [PowerMode](#powermode) | Yes| Power mode to set.|
**Return value** **Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | 2701000 | Operation failed.|
...@@ -50,13 +50,13 @@ Defines the parameters for creating a subwindow or system window. ...@@ -50,13 +50,13 @@ Defines the parameters for creating a subwindow or system window.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description |
| ---------- | -------------------------- | -- | ----------------------------------- | | ---------- | -------------------------- | -- |-----------------------------------------------------------------------------|
| name | string | Yes| Name of the window. | | name | string | Yes| Name of the window. |
| windowType | [WindowType](#windowtype7) | Yes| Type of the window. | | windowType | [WindowType](#windowtype7) | Yes| Type of the window. |
| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | No| Current application context. If this parameter is not set, no context is used.<br>You do not need to set this parameter to create a subwindow in the FA model or a system window in the stage model.| | ctx | [BaseContext](js-apis-inner-application-baseContext.md) | No| Current application context. If no value is passed, no context is used.<br>You do not need to set this parameter to create a subwindow in the FA model or a system window in the stage model.|
| displayId | number | No| ID of the current physical screen. If this parameter is not set, the default value **-1** is used.| | displayId | number | No| ID of the current physical screen. If no value is passed, the default value **-1** is used. The value must be an integer. |
| parentId | number | No| ID of the parent window. If this parameter is not set, the default value **-1** is used. | | parentId | number | No| ID of the parent window. If no value is passed, the default value **-1** is used. The value must be an integer. |
## AvoidAreaType<sup>7+</sup> ## AvoidAreaType<sup>7+</sup>
...@@ -108,10 +108,10 @@ Describes the properties of the status bar and navigation bar. ...@@ -108,10 +108,10 @@ Describes the properties of the status bar and navigation bar.
| Name | Type| Mandatory| Description | | Name | Type| Mandatory| Description |
| -------------------------------------- | -------- | ---- | ------------------------------------------------------------ | | -------------------------------------- | -------- | ---- | ------------------------------------------------------------ |
| statusBarColor | string | No | Background color of the status bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**. | | statusBarColor | string | No | Background color of the status bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**.|
| isStatusBarLightIcon<sup>7+</sup> | boolean | No | Whether any icon on the status bar is highlighted. The value **true** means that the icon is highlighted, and **false** means the opposite. The default value is **false**.| | isStatusBarLightIcon<sup>7+</sup> | boolean | No | Whether any icon on the status bar is highlighted. The value **true** means that the icon is highlighted, and **false** means the opposite. The default value is **false**.|
| statusBarContentColor<sup>8+</sup> | string | No | Color of the text on the status bar. After this property is set, the setting of **isStatusBarLightIcon** is invalid. The default value is **0xE5FFFFFF**.| | statusBarContentColor<sup>8+</sup> | string | No | Color of the text on the status bar. After this property is set, the setting of **isStatusBarLightIcon** is invalid. The default value is **0xE5FFFFFF**.|
| navigationBarColor | string | No | Background color of the navigation bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**. | | navigationBarColor | string | No | Background color of the navigation bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**.|
| isNavigationBarLightIcon<sup>7+</sup> | boolean | No | Whether any icon on the navigation bar is highlighted. The value **true** means that the icon is highlighted, and **false** means the opposite. The default value is **false**.| | isNavigationBarLightIcon<sup>7+</sup> | boolean | No | Whether any icon on the navigation bar is highlighted. The value **true** means that the icon is highlighted, and **false** means the opposite. The default value is **false**.|
| navigationBarContentColor<sup>8+</sup> | string | No | Color of the text on the navigation bar. After this property is set, the setting of **isNavigationBarLightIcon** is invalid. The default value is **0xE5FFFFFF**.| | navigationBarContentColor<sup>8+</sup> | string | No | Color of the text on the navigation bar. After this property is set, the setting of **isNavigationBarLightIcon** is invalid. The default value is **0xE5FFFFFF**.|
...@@ -164,7 +164,7 @@ Describes the callback for a single system bar. ...@@ -164,7 +164,7 @@ Describes the callback for a single system bar.
| type | [WindowType](#windowtype7) | Yes | No | Type of the system bar whose properties are changed. Only the status bar and navigation bar are supported.| | type | [WindowType](#windowtype7) | Yes | No | Type of the system bar whose properties are changed. Only the status bar and navigation bar are supported.|
| isEnable | boolean | Yes | No | Whether the system bar is displayed. The value **true** means that the system bar is displayed, and **false** means the opposite.| | isEnable | boolean | Yes | No | Whether the system bar is displayed. The value **true** means that the system bar is displayed, and **false** means the opposite.|
| region | [Rect](#rect7) | Yes | No | Current position and size of the system bar. | | region | [Rect](#rect7) | Yes | No | Current position and size of the system bar. |
| backgroundColor | string | Yes | No | Background color of the system bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | | backgroundColor | string | Yes | No | Background color of the system bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
| contentColor | string | Yes | No | Color of the text on the system bar. | | contentColor | string | Yes | No | Color of the text on the system bar. |
## SystemBarTintState<sup>8+</sup> ## SystemBarTintState<sup>8+</sup>
...@@ -177,7 +177,7 @@ Describes the callback for the current system bar. ...@@ -177,7 +177,7 @@ Describes the callback for the current system bar.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ---------- | --------------------------------------------------- | ---- | ---- | ---------------------------- | | ---------- | --------------------------------------------------- | ---- | ---- | ---------------------------- |
| displayId | number | Yes | No | ID of the current physical screen. | | displayId | number | Yes | No | ID of the current physical screen. The value must be an integer. |
| regionTint | Array<[SystemBarRegionTint](#systembarregiontint8)> | Yes | No | All system bar information that has been changed.| | regionTint | Array<[SystemBarRegionTint](#systembarregiontint8)> | Yes | No | All system bar information that has been changed.|
## Rect<sup>7+</sup> ## Rect<sup>7+</sup>
...@@ -188,10 +188,10 @@ Describes the rectangular area of the window. ...@@ -188,10 +188,10 @@ Describes the rectangular area of the window.
| Name | Type| Readable| Writable| Description | | Name | Type| Readable| Writable| Description |
| ------ | -------- | ---- | ---- | ------------------ | | ------ | -------- | ---- | ---- | ------------------ |
| left | number | Yes | Yes | Left boundary of the rectangle, in pixels.| | left | number | Yes | Yes | Left boundary of the rectangle, in pixels. The value must be an integer.|
| top | number | Yes | Yes | Top boundary of the rectangle, in pixels.| | top | number | Yes | Yes | Top boundary of the rectangle, in pixels. The value must be an integer.|
| width | number | Yes | Yes | Width of the rectangle, in pixels.| | width | number | Yes | Yes | Width of the rectangle, in pixels. The value must be an integer.|
| height | number | Yes | Yes | Height of the rectangle, in pixels.| | height | number | Yes | Yes | Height of the rectangle, in pixels. The value must be an integer.|
## AvoidArea<sup>7+</sup> ## AvoidArea<sup>7+</sup>
...@@ -215,8 +215,8 @@ Describes the window size. ...@@ -215,8 +215,8 @@ Describes the window size.
| Name | Type| Readable| Writable| Description | | Name | Type| Readable| Writable| Description |
| ------ | -------- | ---- | ---- | ---------- | | ------ | -------- | ---- | ---- | ---------- |
| width | number | Yes | Yes | Window width, in pixels.| | width | number | Yes | Yes | Window width, in pixels. The value must be an integer.|
| height | number | Yes | Yes | Window height, in pixels.| | height | number | Yes | Yes | Window height, in pixels. The value must be an integer.|
## WindowProperties ## WindowProperties
...@@ -225,20 +225,20 @@ Describes the window properties. ...@@ -225,20 +225,20 @@ Describes the window properties.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------------------------------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | | ------------------------------------- | ------------------------- | ---- | ---- |--------------------------------------------------------------------------------------------------------|
| windowRect<sup>7+</sup> | [Rect](#rect7) | Yes | Yes | Window size. | | windowRect<sup>7+</sup> | [Rect](#rect7) | Yes | Yes | Window size. |
| type<sup>7+</sup> | [WindowType](#windowtype7) | Yes | Yes | Window type. | | type<sup>7+</sup> | [WindowType](#windowtype7) | Yes | Yes | Window type. |
| isFullScreen | boolean | Yes | Yes | Whether the window is displayed in full screen mode. The default value is **false**. The value **true** means that the window is displayed in full screen mode, and **false** means the opposite.| | isFullScreen | boolean | Yes | Yes | Whether the window is displayed in full-screen mode. The default value is **false**. The value **true** means that the window is displayed in full-screen mode, and **false** means the opposite. |
| isLayoutFullScreen<sup>7+</sup> | boolean | Yes | Yes | Whether the window layout is in full-screen mode (whether the window is immersive). The default value is **false**. The value **true** means that the window is immersive, and **false** means the opposite.| | isLayoutFullScreen<sup>7+</sup> | boolean | Yes | Yes | Whether the window layout is in full-screen mode (whether the window is immersive). The default value is **false**. The value **true** means that the window is immersive, and **false** means the opposite. |
| focusable<sup>7+</sup> | boolean | Yes | No | Whether the window can gain focus. The default value is **true**. The value **true** means that the window can gain focus, and **false** means the opposite.| | focusable<sup>7+</sup> | boolean | Yes | No | Whether the window can gain focus. The default value is **true**. The value **true** means that the window can gain focus, and **false** means the opposite. |
| touchable<sup>7+</sup> | boolean | Yes | No | Whether the window is touchable. The default value is **true**. The value **true** means that the window is touchable, and **false** means the opposite.| | touchable<sup>7+</sup> | boolean | Yes | No | Whether the window is touchable. The default value is **true**. The value **true** means that the window is touchable, and **false** means the opposite. |
| brightness | number | Yes | Yes | Screen brightness. The value ranges from 0 to 1. The value **1** indicates the maximum brightness. If no value is passed, the brightness follows the system. In this case, the obtained brightness value is –1.| | brightness | number | Yes | Yes | Screen brightness. The value is a floating point number in the range [0.0, 1.0], and the value **1.0** means the brightest. If no value is passed, the brightness follows the system. In this case, the obtained brightness value is **-1**. |
| dimBehindValue<sup>(deprecated)</sup> | number | Yes | Yes | Dimness of the window that is not on top. The value ranges from 0 to 1. The value **1** indicates the maximum dimness.<br>**NOTE**<br>This property is supported since API version 7 and deprecated since API version 9.<br> | | dimBehindValue<sup>(deprecated)</sup> | number | Yes | Yes | Dimness of the window that is not on top. The value is a floating point number in the range [0.0, 1.0], and the value **1.0** means the dimmest.<br>**NOTE**<br>This property is supported since API version 7 and deprecated since API version 9. |
| isKeepScreenOn | boolean | Yes | Yes | Whether the screen is always on. The default value is **false**. The value **true** means that the screen is always on, and **false** means the opposite.| | isKeepScreenOn | boolean | Yes | Yes | Whether the screen is always on. The default value is **false**. The value **true** means that the screen is always on, and **false** means the opposite. |
| isPrivacyMode<sup>7+</sup> | boolean | Yes | Yes | Whether the window is in privacy mode. The default value is **false**. The value **true** means that the window is in privacy mode, and **false** means the opposite.| | isPrivacyMode<sup>7+</sup> | boolean | Yes | Yes | Whether the window is in privacy mode. The default value is **false**. The value **true** means that the window is in privacy mode, and **false** means the opposite. |
| isRoundCorner<sup>(deprecated)</sup> | boolean | Yes | Yes | Whether the window has rounded corners. The default value is **false**. The value **true** means that the window has rounded corners, and **false** means the opposite.<br>**NOTE**<br>This property is supported since API version 7 and deprecated since API version 9.<br> | | isRoundCorner<sup>(deprecated)</sup> | boolean | Yes | Yes | Whether the window has rounded corners. The default value is **false**. The value **true** means that the window has rounded corners, and **false** means the opposite.<br>**NOTE**<br>This property is supported since API version 7 and deprecated since API version 9. |
| isTransparent<sup>7+</sup> | boolean | Yes | Yes | Whether the window is transparent. The default value is **false**. The value **true** means that the window is transparent, and **false** means the opposite.| | isTransparent<sup>7+</sup> | boolean | Yes | Yes | Whether the window is transparent. The default value is **false**. The value **true** means that the window is transparent, and **false** means the opposite. |
| id<sup>9+</sup> | number | Yes | No | Window ID. The default value is **0.0**. | | id<sup>9+</sup> | number | Yes | No | Window ID. The default value is **0**. The value must be an integer. |
## ColorSpace<sup>8+</sup> ## ColorSpace<sup>8+</sup>
...@@ -260,11 +260,11 @@ Describes the scale parameters. ...@@ -260,11 +260,11 @@ Describes the scale parameters.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type| Readable| Writable| Description | | Name | Type| Readable| Writable| Description |
| ------ | -------- | ---- | ---- | -------------------------------------------------- | | ------ | -------- | ---- | ---- |--------------------------------------------|
| x | number | No | Yes | Scale factor along the x-axis. The default value is **1.0**. | | x | number | No | Yes | Scale factor along the x-axis. The value is a floating point number, and the default value is **1.0**. |
| y | number | No | Yes | Scale factor along the y-axis. The default value is **1.0**. | | y | number | No | Yes | Scale factor along the y-axis. The value is a floating point number, and the default value is **1.0**. |
| pivotX | number | No | Yes | X coordinate of the scale center. The value ranges from 0.0 to 1.0, and the default value is **0.5**.| | pivotX | number | No | Yes | X coordinate of the scale center. The value is a floating point number in the range [0.0, 1.0], and the default value is **0.5**.|
| pivotY | number | No | Yes | Y coordinate of the scale center. The value ranges from 0.0 to 1.0, and the default value is **0.5**.| | pivotY | number | No | Yes | Y coordinate of the scale center. The value is a floating point number in the range [0.0, 1.0], and the default value is **0.5**.|
## RotateOptions<sup>9+</sup> ## RotateOptions<sup>9+</sup>
...@@ -275,12 +275,12 @@ Describes the rotation parameters. ...@@ -275,12 +275,12 @@ Describes the rotation parameters.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type| Readable| Writable| Description | | Name | Type| Readable| Writable| Description |
| ------ | -------- | ---- | ---- | -------------------------------------------------- | | ------ | -------- | ---- | ---- |---------------------------------------------|
| x | number | No | Yes | Rotation angle around the x-axis. The default value is **0.0**. | | x | number | No | Yes | Rotation angle around the x-axis. The value is a floating point number, and the default value is **0.0**. |
| y | number | No | Yes | Rotation angle around the y-axis. The default value is **0.0**. | | y | number | No | Yes | Rotation angle around the y-axis. The value is a floating point number, and the default value is **0.0**. |
| z | number | No | Yes | Rotation angle around the z-xis. The default value is **0.0**. | | z | number | No | Yes | Rotation angle around the z-axis. The value is a floating point number, and the default value is **0.0**. |
| pivotX | number | No | Yes | X coordinate of the rotation center. The value ranges from 0.0 to 1.0, and the default value is **0.5**.| | pivotX | number | No | Yes | X coordinate of the rotation center. The value is a floating point number in the range [0.0, 1.0], and the default value is **0.5**.|
| pivotY | number | No | Yes | Y coordinate of the rotation center. The value ranges from 0.0 to 1.0, and the default value is **0.5**.| | pivotY | number | No | Yes | Y coordinate of the rotation center. The value is a floating point number in the range [0.0, 1.0], and the default value is **0.5**. |
## TranslateOptions<sup>9+</sup> ## TranslateOptions<sup>9+</sup>
...@@ -292,9 +292,9 @@ Describes the translation parameters. ...@@ -292,9 +292,9 @@ Describes the translation parameters.
| Name| Type| Readable| Writable| Description | | Name| Type| Readable| Writable| Description |
| ---- | -------- | ---- | ---- | ---------------------------- | | ---- | -------- | ---- | ---- | ---------------------------- |
| x | number | No | Yes | Distance to translate along the x-axis. The default value is **0.0**.| | x | number | No | Yes | Distance to translate along the x-axis. The value is a floating point number, and the default value is **0.0**.|
| y | number | No | Yes | Distance to translate along the y-axis. The default value is **0.0**.| | y | number | No | Yes | Distance to translate along the y-axis. The value is a floating point number, and the default value is **0.0**.|
| z | number | No | Yes | Distance to translate along the z-axis. The default value is **0.0**.| | z | number | No | Yes | Distance to translate along the z-axis. The value is a floating point number, and the default value is **0.0**.|
## window.createWindow<sup>9+</sup> ## window.createWindow<sup>9+</sup>
...@@ -519,7 +519,7 @@ Minimizes all windows on a display. This API uses an asynchronous callback to re ...@@ -519,7 +519,7 @@ Minimizes all windows on a display. This API uses an asynchronous callback to re
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------- | | -------- | ------------------------- | ---- | -------------- |
| id | number | Yes | ID of the [display](js-apis-display.md#display).| | id | number | Yes | ID of the [display](js-apis-display.md#display). The value must be an integer.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes** **Error codes**
...@@ -568,7 +568,7 @@ Minimizes all windows on a display. This API uses a promise to return the result ...@@ -568,7 +568,7 @@ Minimizes all windows on a display. This API uses a promise to return the result
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------- | | -------- | ------------------------- | ---- | -------------- |
| id | number | Yes | ID of the [display](js-apis-display.md#display).| | id | number | Yes | ID of the [display](js-apis-display.md#display). The value must be an integer.|
**Return value** **Return value**
...@@ -1552,8 +1552,8 @@ This operation is not supported in a window in full-screen mode. ...@@ -1552,8 +1552,8 @@ This operation is not supported in a window in full-screen mode.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | ------------------------- | -- | --------------------------------------------- | | -------- | ------------------------- | -- | --------------------------------------------- |
| x | number | Yes| Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.| | x | number | Yes| Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right. The value must be an integer.|
| y | number | Yes| Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.| | y | number | Yes| Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards. The value must be an integer.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. |
**Error codes** **Error codes**
...@@ -1595,8 +1595,8 @@ This operation is not supported in a window in full-screen mode. ...@@ -1595,8 +1595,8 @@ This operation is not supported in a window in full-screen mode.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -- | ----- | -- | --------------------------------------------- | | -- | ----- | -- | --------------------------------------------- |
| x | number | Yes| Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.| | x | number | Yes| Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right. The value must be an integer.|
| y | number | Yes| Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.| | y | number | Yes| Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards. The value must be an integer.|
**Return value** **Return value**
...@@ -1648,8 +1648,8 @@ This operation is not supported in a window in full-screen mode. ...@@ -1648,8 +1648,8 @@ This operation is not supported in a window in full-screen mode.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | ------------------------- | -- | ------------------------ | | -------- | ------------------------- | -- | ------------------------ |
| width | number | Yes| New width of the window, in px.| | width | number | Yes| New width of the window, in px. The value must be an integer.|
| height | number | Yes| New height of the window, in px.| | height | number | Yes| New height of the window, in px. The value must be an integer.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. |
**Error codes** **Error codes**
...@@ -1697,8 +1697,8 @@ This operation is not supported in a window in full-screen mode. ...@@ -1697,8 +1697,8 @@ This operation is not supported in a window in full-screen mode.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ------ | ------ | -- | ------------------------ | | ------ | ------ | -- | ------------------------ |
| width | number | Yes| New width of the window, in px.| | width | number | Yes| New width of the window, in px. The value must be an integer.|
| height | number | Yes| New height of the window, in px.| | height | number | Yes| New height of the window, in px. The value must be an integer.|
**Return value** **Return value**
...@@ -2576,9 +2576,9 @@ Enables listening for keyboard height changes. ...@@ -2576,9 +2576,9 @@ Enables listening for keyboard height changes.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------- | ---- |-------------------------------------------|
| type | string | Yes | Event type. The value is fixed at **'keyboardHeightChange'**, indicating the keyboard height change event.| | type | string | Yes | Event type. The value is fixed at **'keyboardHeightChange'**, indicating the keyboard height change event.|
| callback | Callback&lt;number&gt; | Yes | Callback used to return the current keyboard height. | | callback | Callback&lt;number&gt; | Yes | Callback used to return the current keyboard height, which is an integer. |
**Example** **Example**
...@@ -2605,7 +2605,7 @@ Disables listening for keyboard height changes. ...@@ -2605,7 +2605,7 @@ Disables listening for keyboard height changes.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------------------------------ | | -------- | ---------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value is fixed at **'keyboardHeightChange'**, indicating the keyboard height change event.| | type | string | Yes | Event type. The value is fixed at **'keyboardHeightChange'**, indicating the keyboard height change event.|
| callback | Callback&lt;number&gt; | No | Callback used to return the current keyboard height. | | callback | Callback&lt;number&gt; | No | Callback used to return the current keyboard height, which is an integer. |
**Example** **Example**
...@@ -2661,7 +2661,7 @@ Disables listening for click events outside this window. ...@@ -2661,7 +2661,7 @@ Disables listening for click events outside this window.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------------------------------ | | -------- | ---------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value is fixed at **'touchOutside'**, indicating the click event outside this window.| | type | string | Yes | Event type. The value is fixed at **'touchOutside'**, indicating the click event outside this window.|
| callback | Callback&lt;number&gt; | No | Callback used to return the click event outside this window. | | callback | Callback&lt;void&gt; | No | Callback used to return the click event outside this window. |
**Example** **Example**
...@@ -3097,9 +3097,9 @@ When the screen brightness setting for the window takes effect, Control Panel ca ...@@ -3097,9 +3097,9 @@ When the screen brightness setting for the window takes effect, Control Panel ca
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description |
| ---------- | ------------------------- | -- | --------------------------------- | | ---------- | ------------------------- | -- |-------------------------------------------|
| brightness | number | Yes| Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| | brightness | number | Yes| Brightness to set. The value is a floating point number in the range [0.0, 1.0], and the value **1.0** means the brightest.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. |
**Error codes** **Error codes**
...@@ -3140,9 +3140,9 @@ When the screen brightness setting for the window takes effect, Control Panel ca ...@@ -3140,9 +3140,9 @@ When the screen brightness setting for the window takes effect, Control Panel ca
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description |
| ---------- | ------ | -- | --------------------------------- | | ---------- | ------ | -- |----------------------------------------|
| brightness | number | Yes| Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| | brightness | number | Yes| Brightness to set. The value is a floating point number in the range [0.0, 1.0], and the value **1.0** means the brightest.|
**Return value** **Return value**
...@@ -3761,8 +3761,8 @@ Sets the opacity for this window. This API can be used only when you [customize ...@@ -3761,8 +3761,8 @@ Sets the opacity for this window. This API can be used only when you [customize
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ----------------------------------------------------------- | | ------- | ------ | ---- |----------------------------------------------------|
| opacity | number | Yes | Opacity to set. The value ranges from 0.0 to 1.0. The value **0.0** means completely transparent, and **1.0** means completely opaque.| | opacity | number | Yes | Opacity. The value is a floating point number in the range [0.0, 1.0]. The value **0.0** means completely transparent, and **1.0** means completely opaque.|
**Error codes** **Error codes**
...@@ -3981,8 +3981,8 @@ Blurs this window. ...@@ -3981,8 +3981,8 @@ Blurs this window.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- |--------------------------------------------------|
| radius | number | Yes | Radius of the blur. The value is greater than or equal to 0. The value **0** means that the blur is disabled for the window.| | radius | number | Yes | Radius of the blur. The value is a floating point number greater than or equal to 0.0, and the value **0.0** means that the blur is disabled for the window.|
**Error codes** **Error codes**
...@@ -4016,8 +4016,8 @@ Blurs the background of this window. ...@@ -4016,8 +4016,8 @@ Blurs the background of this window.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- |-------------------------------------------------------|
| radius | number | Yes | Radius of the blur. The value is greater than or equal to 0. The value **0** means that the blur is disabled for the background of the window.| | radius | number | Yes | Radius of the blur. The value is a floating point number greater than or equal to 0.0, and the value **0.0** means that the blur is disabled for the background of the window.|
**Error codes** **Error codes**
...@@ -4086,11 +4086,11 @@ Sets the shadow for the window borders. ...@@ -4086,11 +4086,11 @@ Sets the shadow for the window borders.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------------ | | ------- | ------ | ---- |-------------------------------------------------------------|
| radius | number | Yes | Radius of the shadow. The value is greater than or equal to 0. The value **0** means that the shadow is disabled for the window borders.| | radius | number | Yes | Radius of the shadow. The value is a floating point number greater than or equal to 0.0, and the value **0.0** means that the shadow is disabled for the window borders. |
| color | string | No | Color of the shadow. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.| | color | string | No | Color of the shadow. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
| offsetX | number | No | Offset of the shadow along the x-axis, in pixels. | | offsetX | number | No | Offset of the shadow along the x-axis, in pixels. The value is a floating point number. |
| offsetY | number | No | Offset of the shadow along the y-axis, in pixels. | | offsetY | number | No | Offset of the shadow along the y-axis, in pixels. The value is a floating point number. |
**Error codes** **Error codes**
...@@ -4124,8 +4124,8 @@ Sets the radius of the rounded corners for this window. ...@@ -4124,8 +4124,8 @@ Sets the radius of the rounded corners for this window.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------- | ------- | ---- | -------------------- | | ----------- | ------- | ---- |----------------------------------------------------|
| radius | number | Yes | Radius of the rounded corners. The value is greater than or equal to 0. The value **0** means that the window does not use rounded corners.| | radius | number | Yes | Radius of the rounded corners. The value is a floating point number greater than or equal to 0.0. The value **0.0** means that the window does not use rounded corners.|
**Error codes** **Error codes**
...@@ -4282,8 +4282,8 @@ This operation is not supported in a window in full-screen mode. ...@@ -4282,8 +4282,8 @@ This operation is not supported in a window in full-screen mode.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------- | | -------- | ------------------------- | ---- | ------------------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.| | x | number | Yes | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right. The value must be an integer.|
| y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.| | y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards. The value must be an integer.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -4316,8 +4316,8 @@ This operation is not supported in a window in full-screen mode. ...@@ -4316,8 +4316,8 @@ This operation is not supported in a window in full-screen mode.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------- | | ------ | ------ | ---- | ------------------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.| | x | number | Yes | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right. The value must be an integer.|
| y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.| | y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards. The value must be an integer.|
**Return value** **Return value**
...@@ -4360,8 +4360,8 @@ This operation is not supported in a window in full-screen mode. ...@@ -4360,8 +4360,8 @@ This operation is not supported in a window in full-screen mode.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------------------- | | -------- | ------------------------- | ---- | -------------------------- |
| width | number | Yes | New width of the window, in px.| | width | number | Yes | New width of the window, in px. The value must be an integer.|
| height | number | Yes | New height of the window, in px.| | height | number | Yes | New height of the window, in px. The value must be an integer.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -4400,8 +4400,8 @@ This operation is not supported in a window in full-screen mode. ...@@ -4400,8 +4400,8 @@ This operation is not supported in a window in full-screen mode.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------- | | ------ | ------ | ---- | -------------------------- |
| width | number | Yes | New width of the window, in px.| | width | number | Yes | New width of the window, in px. The value must be an integer.|
| height | number | Yes | New height of the window, in px.| | height | number | Yes | New height of the window, in px. The value must be an integer.|
**Return value** **Return value**
...@@ -5351,8 +5351,8 @@ When the screen brightness setting for the window takes effect, Control Panel ca ...@@ -5351,8 +5351,8 @@ When the screen brightness setting for the window takes effect, Control Panel ca
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------- | ---- | ------------------------------------ | | ---------- | ------------------------- | ---- |---------------------------------------|
| brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| | brightness | number | Yes | Brightness to set. The value is a floating point number in the range [0.0, 1.0], and the value **1.0** means the brightest.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -5385,8 +5385,8 @@ When the screen brightness setting for the window takes effect, Control Panel ca ...@@ -5385,8 +5385,8 @@ When the screen brightness setting for the window takes effect, Control Panel ca
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | ------------------------------------ | | ---------- | ------ | ---- |------------------------------------------|
| brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| | brightness | number | Yes | Brightness to set. The value is a floating point number in the range [0.0, 1.0], and the value **1.0** means the brightest.|
**Return value** **Return value**
...@@ -5421,8 +5421,8 @@ Sets the dimness of the window that is not on top. This API uses an asynchronous ...@@ -5421,8 +5421,8 @@ Sets the dimness of the window that is not on top. This API uses an asynchronous
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ------------------------- | ---- | -------------------------------------------------- | | -------------- | ------------------------- | ---- |----------------------------------------|
| dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.| | dimBehindValue | number | Yes | Dimness of the window to set. The value range is [0.0, 1.0], and the value **1.0** means the dimmest.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example** **Example**
......
...@@ -83,9 +83,9 @@ import worker from '@ohos.worker'; ...@@ -83,9 +83,9 @@ import worker from '@ohos.worker';
// Create a Worker instance. // Create a Worker instance.
// In the FA model, the workers directory is at the same level as the pages directory in the entry module. // In the FA model, the workers directory is at the same level as the pages directory in the entry module.
const workerFAModel01 = new worker.ThreadWorker("workers/worker.js", {name:"first worker in FA model"}); const workerFAModel01 = new worker.ThreadWorker("workers/worker.ts", {name:"first worker in FA model"});
// In the FA model, the workers directory is at the same level as the parent directory of the pages directory in the entry module. // In the FA model, the workers directory is at the same level as the parent directory of the pages directory in the entry module.
const workerFAModel02 = new worker.ThreadWorker("../workers/worker.js"); const workerFAModel02 = new worker.ThreadWorker("../workers/worker.ts");
// In the stage model, the workers directory is at the same level as the pages directory in the entry module. // In the stage model, the workers directory is at the same level as the pages directory in the entry module.
const workerStageModel01 = new worker.ThreadWorker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"}); const workerStageModel01 = new worker.ThreadWorker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"});
...@@ -115,7 +115,7 @@ In the FA model: ...@@ -115,7 +115,7 @@ In the FA model:
"buildOption": { "buildOption": {
"sourceOption": { "sourceOption": {
"workers": [ "workers": [
"./src/main/ets/MainAbility/workers/worker.ts" "./src/main/ets/entryability/workers/worker.ts"
] ]
} }
} }
...@@ -161,9 +161,9 @@ In the stage model: ...@@ -161,9 +161,9 @@ In the stage model:
### postMessage<sup>9+</sup> ### postMessage<sup>9+</sup>
postMessage(message: Object, transfer: ArrayBuffer[]): void; postMessage(message: Object, transfer: ArrayBuffer[]): void
Sends a message to the worker thread. The data type of the message must be sequenceable. For details about the sequenceable data types, see [More Information](#more-information). Used by the host thread to send a message to the worker thread by transferring object ownership.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -171,8 +171,8 @@ Sends a message to the worker thread. The data type of the message must be seque ...@@ -171,8 +171,8 @@ Sends a message to the worker thread. The data type of the message must be seque
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ------------------------------------------------------------ | | -------- | ------------- | ---- | ------------------------------------------------------------ |
| message | Object | Yes | Message to be sent to the worker thread. | | message | Object | Yes | Data to be sent to the worker thread. The data object must be sequenceable. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
| transfer | ArrayBuffer[] | Yes | An **ArrayBuffer** object can be transferred. The value **null** should not be passed in the array.| | transfer | ArrayBuffer[] | Yes | **ArrayBuffer** instance holding an array of objects for which the ownership is transferred to the worker thread. After the transfer, the objects are available only in the worker thread. The array cannot be null.|
**Error codes** **Error codes**
...@@ -181,7 +181,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ...@@ -181,7 +181,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 10200004 | Worker instance is not running. | | 10200004 | Worker instance is not running. |
| 10200006 | Serializing an uncaught exception failed. | | 10200006 | An exception occurred during serialization. |
**Example** **Example**
...@@ -196,7 +196,7 @@ workerInstance.postMessage(buffer, [buffer]); ...@@ -196,7 +196,7 @@ workerInstance.postMessage(buffer, [buffer]);
postMessage(message: Object, options?: PostMessageOptions): void postMessage(message: Object, options?: PostMessageOptions): void
Sends a message to the worker thread. The data type of the message must be sequenceable. For details about the sequenceable data types, see [More Information](#more-information). Used by the host thread to send a message to the worker thread by transferring object ownership or copying data.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -204,8 +204,8 @@ Sends a message to the worker thread. The data type of the message must be seque ...@@ -204,8 +204,8 @@ Sends a message to the worker thread. The data type of the message must be seque
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| message | Object | Yes | Message to be sent to the worker thread. | | message | Object | Yes | Data to be sent to the worker thread. The data object must be sequenceable. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.| | options | [PostMessageOptions](#postmessageoptions) | No | If this parameter is specified, it functions the same as **ArrayBuffer[]**. Specifically, the ownership of the objects in the array is transferred to the worker thread and becomes unavailable in the host thread. The objects are available only in the worker thread.<br>If this parameter is not specified, the default value **undefined** is used, and information is transferred to the worker thread by copying data.|
**Error codes** **Error codes**
...@@ -214,7 +214,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ...@@ -214,7 +214,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 10200004 | Worker instance is not running. | | 10200004 | Worker instance is not running. |
| 10200006 | Serializing an uncaught exception failed. | | 10200006 | An exception occurred during serialization. |
**Example** **Example**
...@@ -617,7 +617,7 @@ workerInstance.dispatchEvent({type:"alert_once", timeStamp:0});// timeStamp is n ...@@ -617,7 +617,7 @@ workerInstance.dispatchEvent({type:"alert_once", timeStamp:0});// timeStamp is n
// The event listener created by on will not be proactively deleted. // The event listener created by on will not be proactively deleted.
workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_on", timeStamp:0});
workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_on", timeStamp:0});
// The event listener created by addEventListener will be always valid and will not be proactively deleted. // The event listener created by addEventListener will not be proactively deleted.
workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_add", timeStamp:0});
workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_add", timeStamp:0});
...@@ -792,7 +792,7 @@ workerInstance.dispatchEvent({type:"alert_once", timeStamp:0});// timeStamp is n ...@@ -792,7 +792,7 @@ workerInstance.dispatchEvent({type:"alert_once", timeStamp:0});// timeStamp is n
// The event listener created by on will not be proactively deleted. // The event listener created by on will not be proactively deleted.
workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_on", timeStamp:0});
workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_on", timeStamp:0});
// The event listener created by addEventListener will be always valid and will not be proactively deleted. // The event listener created by addEventListener will not be proactively deleted.
workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_add", timeStamp:0});
workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_add", timeStamp:0});
...@@ -849,16 +849,16 @@ Implements communication between the worker thread and the host thread. The **po ...@@ -849,16 +849,16 @@ Implements communication between the worker thread and the host thread. The **po
postMessage(messageObject: Object, transfer: ArrayBuffer[]): void; postMessage(messageObject: Object, transfer: ArrayBuffer[]): void;
Sends a message to the host thread from the worker thread. Used by the worker thread to send a message to the host thread by transferring object ownership.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ------------------------------------------------------- | | -------- | ------------- | ---- | ------------------------------------------------------------ |
| message | Object | Yes | Message to be sent to the host thread. | | message | Object | Yes | Data to be sent to the host thread. The data object must be sequenceable. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
| transfer | ArrayBuffer[] | Yes | An **ArrayBuffer** object can be transferred. The value **null** should not be passed in the array.| | transfer | ArrayBuffer[] | Yes | **ArrayBuffer** instance holding an array of objects for which the ownership is transferred to the host thread. After the transfer, the objects are available only in the host thread. The array cannot be null.|
**Error codes** **Error codes**
...@@ -867,18 +867,18 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ...@@ -867,18 +867,18 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 10200004 | Worker instance is not running. | | 10200004 | Worker instance is not running. |
| 10200006 | Serializing an uncaught exception failed. | | 10200006 | An exception occurred during serialization. |
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts");
workerInstance.postMessage("hello world"); workerInstance.postMessage("hello world");
workerInstance.onmessage = function(e) { workerInstance.onmessage = function(e) {
// let data = e.data; // let data = e.data;
console.log("receive data from worker.js"); console.log("receive data from worker.ts");
} }
``` ```
...@@ -897,7 +897,7 @@ workerPort.onmessage = function(e){ ...@@ -897,7 +897,7 @@ workerPort.onmessage = function(e){
postMessage(messageObject: Object, options?: PostMessageOptions): void postMessage(messageObject: Object, options?: PostMessageOptions): void
Sends a message to the host thread from the worker thread. Used by the worker thread to send a message to the host thread by transferring object ownership or copying data.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -905,8 +905,8 @@ Sends a message to the host thread from the worker thread. ...@@ -905,8 +905,8 @@ Sends a message to the host thread from the worker thread.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| message | Object | Yes | Message to be sent to the host thread. | | message | Object | Yes | Data to be sent to the host thread. The data object must be sequenceable. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.| | options | [PostMessageOptions](#postmessageoptions) | No | If this parameter is specified, it functions the same as **ArrayBuffer[]**. Specifically, the ownership of the objects in the array is transferred to the host thread and becomes unavailable in the worker thread. The objects are available only in the host thread.<br>If this parameter is not specified, the default value **undefined** is used, and information is transferred to the host thread by copying data.|
**Error codes** **Error codes**
...@@ -915,18 +915,18 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ...@@ -915,18 +915,18 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 10200004 | Worker instance is not running. | | 10200004 | Worker instance is not running. |
| 10200006 | Serializing an uncaught exception failed. | | 10200006 | An exception occurred during serialization. |
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts");
workerInstance.postMessage("hello world"); workerInstance.postMessage("hello world");
workerInstance.onmessage = function(e) { workerInstance.onmessage = function(e) {
// let data = e.data; // let data = e.data;
console.log("receive data from worker.js"); console.log("receive data from worker.ts");
} }
``` ```
...@@ -936,7 +936,7 @@ import worker from '@ohos.worker'; ...@@ -936,7 +936,7 @@ import worker from '@ohos.worker';
const workerPort = worker.workerPort; const workerPort = worker.workerPort;
workerPort.onmessage = function(e){ workerPort.onmessage = function(e){
// let data = e.data; // let data = e.data;
workerPort.postMessage("receive data from main.js"); workerPort.postMessage("receive data from main thread");
} }
``` ```
...@@ -960,7 +960,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ...@@ -960,7 +960,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts");
``` ```
...@@ -1002,7 +1002,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ...@@ -1002,7 +1002,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts");
workerInstance.postMessage("hello world"); workerInstance.postMessage("hello world");
...@@ -1013,7 +1013,7 @@ workerInstance.postMessage("hello world"); ...@@ -1013,7 +1013,7 @@ workerInstance.postMessage("hello world");
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerPort = worker.workerPort; const workerPort = worker.workerPort;
workerPort.onmessage = function(e) { workerPort.onmessage = function(e) {
console.log("receive main.js message"); console.log("receive main thread message");
} }
``` ```
...@@ -1045,7 +1045,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ...@@ -1045,7 +1045,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts");
``` ```
...@@ -1055,7 +1055,7 @@ const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); ...@@ -1055,7 +1055,7 @@ const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts");
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const parentPort = worker.workerPort; const parentPort = worker.workerPort;
parentPort.onmessageerror = function(e) { parentPort.onmessageerror = function(e) {
console.log("worker.js onmessageerror") console.log("worker.ts onmessageerror")
} }
``` ```
...@@ -1130,7 +1130,7 @@ Defines the event handler to be called when an exception occurs during worker ex ...@@ -1130,7 +1130,7 @@ Defines the event handler to be called when an exception occurs during worker ex
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts") const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts")
``` ```
...@@ -1140,7 +1140,7 @@ const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts") ...@@ -1140,7 +1140,7 @@ const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts")
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerPort = worker.workerPort const workerPort = worker.workerPort
workerPort.onerror = function(e){ workerPort.onerror = function(e){
console.log("worker.js onerror") console.log("worker.ts onerror")
} }
``` ```
...@@ -1193,9 +1193,9 @@ import worker from '@ohos.worker'; ...@@ -1193,9 +1193,9 @@ import worker from '@ohos.worker';
// Create a Worker instance. // Create a Worker instance.
// In the FA model, the workers directory is at the same level as the pages directory. // In the FA model, the workers directory is at the same level as the pages directory.
const workerFAModel01 = new worker.Worker("workers/worker.js", {name:"first worker in FA model"}); const workerFAModel01 = new worker.Worker("workers/worker.ts", {name:"first worker in FA model"});
// In the FA model, the workers directory is at the same level as the parent directory of the pages directory. // In the FA model, the workers directory is at the same level as the parent directory of the pages directory.
const workerFAModel02 = new worker.Worker("../workers/worker.js"); const workerFAModel02 = new worker.Worker("../workers/worker.ts");
// In the stage model, the workers directory is at the same level as the pages directory. // In the stage model, the workers directory is at the same level as the pages directory.
const workerStageModel01 = new worker.Worker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"}); const workerStageModel01 = new worker.Worker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"});
...@@ -1216,7 +1216,7 @@ In the FA model: ...@@ -1216,7 +1216,7 @@ In the FA model:
"buildOption": { "buildOption": {
"sourceOption": { "sourceOption": {
"workers": [ "workers": [
"./src/main/ets/MainAbility/workers/worker.ts" "./src/main/ets/entryability/workers/worker.ts"
] ]
} }
} }
...@@ -1256,9 +1256,9 @@ In the stage model: ...@@ -1256,9 +1256,9 @@ In the stage model:
### postMessage<sup>(deprecated)</sup> ### postMessage<sup>(deprecated)</sup>
postMessage(message: Object, transfer: ArrayBuffer[]): void; postMessage(message: Object, transfer: ArrayBuffer[]): void
Sends a message to the worker thread. The data type of the message must be sequenceable. For details about the sequenceable data types, see [More Information](#more-information). Used by the host thread to send a message to the worker thread by transferring object ownership.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorker.postMessage<sup>9+</sup>](#postmessage9) instead. > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorker.postMessage<sup>9+</sup>](#postmessage9) instead.
...@@ -1268,14 +1268,14 @@ Sends a message to the worker thread. The data type of the message must be seque ...@@ -1268,14 +1268,14 @@ Sends a message to the worker thread. The data type of the message must be seque
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ----------------------------------------------- | | -------- | ------------- | ---- | ------------------------------------------------------------ |
| message | Object | Yes | Message to be sent to the worker thread. | | message | Object | Yes | Data to be sent to the worker thread. The data object must be sequenceable. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
| transfer | ArrayBuffer[] | Yes | **ArrayBuffer** instances that can be transferred.| | transfer | ArrayBuffer[] | Yes | **ArrayBuffer** instance holding an array of objects for which the ownership is transferred to the worker thread. After the transfer, the objects are available only in the worker thread. The array cannot be null.|
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
var buffer = new ArrayBuffer(8); var buffer = new ArrayBuffer(8);
workerInstance.postMessage(buffer, [buffer]); workerInstance.postMessage(buffer, [buffer]);
...@@ -1285,7 +1285,7 @@ workerInstance.postMessage(buffer, [buffer]); ...@@ -1285,7 +1285,7 @@ workerInstance.postMessage(buffer, [buffer]);
postMessage(message: Object, options?: PostMessageOptions): void postMessage(message: Object, options?: PostMessageOptions): void
Sends a message to the worker thread. The data type of the message must be sequenceable. For details about the sequenceable data types, see [More Information](#more-information). Used by the host thread to send a message to the worker thread by transferring object ownership or copying data.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorker.postMessage<sup>9+</sup>](#postmessage9-1) instead. > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorker.postMessage<sup>9+</sup>](#postmessage9-1) instead.
...@@ -1296,13 +1296,13 @@ Sends a message to the worker thread. The data type of the message must be seque ...@@ -1296,13 +1296,13 @@ Sends a message to the worker thread. The data type of the message must be seque
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| message | Object | Yes | Message to be sent to the worker thread. | | message | Object | Yes | Data to be sent to the worker thread. The data object must be sequenceable. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.| | options | [PostMessageOptions](#postmessageoptions) | No | If this parameter is specified, it functions the same as **ArrayBuffer[]**. Specifically, the ownership of the objects in the array is transferred to the worker thread and becomes unavailable in the host thread. The objects are available only in the worker thread.<br>If this parameter is not specified, the default value **undefined** is used, and information is transferred to the worker thread by copying data.|
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.postMessage("hello world"); workerInstance.postMessage("hello world");
...@@ -1332,7 +1332,7 @@ Adds an event listener for the worker thread. This API provides the same functio ...@@ -1332,7 +1332,7 @@ Adds an event listener for the worker thread. This API provides the same functio
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.on("alert", (e)=>{ workerInstance.on("alert", (e)=>{
console.log("alert listener callback"); console.log("alert listener callback");
}) })
...@@ -1360,7 +1360,7 @@ Adds an event listener for the worker thread and removes the event listener afte ...@@ -1360,7 +1360,7 @@ Adds an event listener for the worker thread and removes the event listener afte
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.once("alert", (e)=>{ workerInstance.once("alert", (e)=>{
console.log("alert listener callback"); console.log("alert listener callback");
}) })
...@@ -1388,7 +1388,7 @@ Removes an event listener for the worker thread. This API provides the same func ...@@ -1388,7 +1388,7 @@ Removes an event listener for the worker thread. This API provides the same func
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
// Use on, once, or addEventListener to add a listener for the "alert" event, and use off to remove the listener. // Use on, once, or addEventListener to add a listener for the "alert" event, and use off to remove the listener.
workerInstance.off("alert"); workerInstance.off("alert");
``` ```
...@@ -1408,7 +1408,7 @@ Terminates the worker thread to stop it from receiving messages. ...@@ -1408,7 +1408,7 @@ Terminates the worker thread to stop it from receiving messages.
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.terminate(); workerInstance.terminate();
``` ```
...@@ -1433,7 +1433,7 @@ Defines the event handler to be called when the worker thread exits. The handler ...@@ -1433,7 +1433,7 @@ Defines the event handler to be called when the worker thread exits. The handler
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.onexit = function(e) { workerInstance.onexit = function(e) {
console.log("onexit"); console.log("onexit");
} }
...@@ -1467,7 +1467,7 @@ Defines the event handler to be called when an exception occurs during worker ex ...@@ -1467,7 +1467,7 @@ Defines the event handler to be called when an exception occurs during worker ex
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.onerror = function(e) { workerInstance.onerror = function(e) {
console.log("onerror"); console.log("onerror");
} }
...@@ -1489,12 +1489,12 @@ Defines the event handler to be called when the host thread receives a message s ...@@ -1489,12 +1489,12 @@ Defines the event handler to be called when the host thread receives a message s
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------------------ | ---- | ---------------------- | | ------ | ------------------------------ | ---- | ---------------------- |
| event | [MessageEvent](#messageeventt) | Yes | Message received.| | event | [MessageEvent](#messageeventt)| Yes | Message received.|
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.onmessage = function(e) { workerInstance.onmessage = function(e) {
// e: MessageEvent. The usage is as follows: // e: MessageEvent. The usage is as follows:
// let data = e.data; // let data = e.data;
...@@ -1518,12 +1518,12 @@ Defines the event handler to be called when the worker thread receives a message ...@@ -1518,12 +1518,12 @@ Defines the event handler to be called when the worker thread receives a message
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------------------ | ---- | ---------- | | ------ | ------------------------------ | ---- | ---------- |
| event | [MessageEvent](#messageeventt) | Yes | Error data.| | event | [MessageEvent](#messageeventt)| Yes | Error data.|
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.onmessageerror= function(e) { workerInstance.onmessageerror= function(e) {
console.log("onmessageerror"); console.log("onmessageerror");
} }
...@@ -1555,7 +1555,7 @@ Adds an event listener for the worker thread. This API provides the same functio ...@@ -1555,7 +1555,7 @@ Adds an event listener for the worker thread. This API provides the same functio
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.addEventListener("alert", (e)=>{ workerInstance.addEventListener("alert", (e)=>{
console.log("alert listener callback"); console.log("alert listener callback");
}) })
...@@ -1583,7 +1583,7 @@ Removes an event listener for the worker thread. This API provides the same func ...@@ -1583,7 +1583,7 @@ Removes an event listener for the worker thread. This API provides the same func
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.addEventListener("alert", (e)=>{ workerInstance.addEventListener("alert", (e)=>{
console.log("alert listener callback"); console.log("alert listener callback");
}) })
...@@ -1617,7 +1617,7 @@ Dispatches the event defined for the worker thread. ...@@ -1617,7 +1617,7 @@ Dispatches the event defined for the worker thread.
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is not supported yet. workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is not supported yet.
``` ```
...@@ -1625,7 +1625,7 @@ workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is n ...@@ -1625,7 +1625,7 @@ workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is n
The **dispatchEvent** API can be used together with the **on**, **once**, and **addEventListener** APIs. The sample code is as follows: The **dispatchEvent** API can be used together with the **on**, **once**, and **addEventListener** APIs. The sample code is as follows:
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
// Usage 1: // Usage 1:
workerInstance.on("alert_on", (e)=>{ workerInstance.on("alert_on", (e)=>{
...@@ -1677,7 +1677,7 @@ Removes all event listeners for the worker thread. ...@@ -1677,7 +1677,7 @@ Removes all event listeners for the worker thread.
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.addEventListener("alert", (e)=>{ workerInstance.addEventListener("alert", (e)=>{
console.log("alert listener callback"); console.log("alert listener callback");
}) })
...@@ -1696,7 +1696,7 @@ Implements communication between the worker thread and the host thread. The **po ...@@ -1696,7 +1696,7 @@ Implements communication between the worker thread and the host thread. The **po
postMessage(messageObject: Object, transfer: Transferable[]): void; postMessage(messageObject: Object, transfer: Transferable[]): void;
Sends a message to the host thread from the worker thread. Used by the worker thread to send a message to the host thread by transferring object ownership.
> **NOTE**<br> > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>.postMessage<sup>9+</sup>](#postmessage9-2). > This API is deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>.postMessage<sup>9+</sup>](#postmessage9-2).
...@@ -1707,14 +1707,14 @@ Sends a message to the host thread from the worker thread. ...@@ -1707,14 +1707,14 @@ Sends a message to the host thread from the worker thread.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| messageObject | Object | Yes | Message to be sent to the host thread. | | messageObject | Object | Yes | Data to be sent to the host thread. The data object must be sequenceable. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
| transfer| Transferable[] | Yes | Currently, this parameter is not supported. | | transfer| Transferable[] | Yes | Currently, this parameter is not supported. |
### postMessage<sup>9+</sup> ### postMessage<sup>9+</sup>
postMessage(messageObject: Object, transfer: ArrayBuffer[]): void; postMessage(messageObject: Object, transfer: ArrayBuffer[]): void;
Sends a message to the host thread from the worker thread. Used by the worker thread to send a message to the host thread by transferring object ownership.
> **NOTE** > **NOTE**
> >
...@@ -1725,24 +1725,24 @@ Sends a message to the host thread from the worker thread. ...@@ -1725,24 +1725,24 @@ Sends a message to the host thread from the worker thread.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ----------------------------------------------------- | | -------- | ------------- | ---- | ------------------------------------------------------------ |
| message | Object | Yes | Message to be sent to the host thread. | | message | Object | Yes | Data to be sent to the host thread. The data object must be sequenceable. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
| transfer | ArrayBuffer[] | Yes | An **ArrayBuffer** object can be transferred. The value **null** should not be passed in the array.| | transfer | ArrayBuffer[] | Yes | **ArrayBuffer** instance holding an array of objects for which the ownership is transferred to the host thread. After the transfer, the objects are available only in the host thread. The array cannot be null.|
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.postMessage("hello world"); workerInstance.postMessage("hello world");
workerInstance.onmessage = function(e) { workerInstance.onmessage = function(e) {
// let data = e.data; // let data = e.data;
console.log("receive data from worker.js"); console.log("receive data from worker.ts");
} }
``` ```
```js ```js
// worker.js // worker.ts
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const parentPort = worker.parentPort; const parentPort = worker.parentPort;
parentPort.onmessage = function(e){ parentPort.onmessage = function(e){
...@@ -1756,7 +1756,7 @@ parentPort.onmessage = function(e){ ...@@ -1756,7 +1756,7 @@ parentPort.onmessage = function(e){
postMessage(messageObject: Object, options?: PostMessageOptions): void postMessage(messageObject: Object, options?: PostMessageOptions): void
Sends a message to the host thread from the worker thread. Used by the worker thread to send a message to the host thread by transferring object ownership or copying data.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>.postMessage<sup>9+</sup>](#postmessage9-3). > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope<sup>9+</sup>.postMessage<sup>9+</sup>](#postmessage9-3).
...@@ -1767,28 +1767,28 @@ Sends a message to the host thread from the worker thread. ...@@ -1767,28 +1767,28 @@ Sends a message to the host thread from the worker thread.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| message | Object | Yes | Message to be sent to the host thread. | | message | Object | Yes | Data to be sent to the host thread. The data object must be sequenceable. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).|
| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.| | options | [PostMessageOptions](#postmessageoptions) | No | If this parameter is specified, it functions the same as **ArrayBuffer[]**. Specifically, the ownership of the objects in the array is transferred to the host thread and becomes unavailable in the worker thread. The objects are available only in the host thread.<br>If this parameter is not specified, the default value **undefined** is used, and information is transferred to the host thread by copying data.|
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.postMessage("hello world"); workerInstance.postMessage("hello world");
workerInstance.onmessage = function(e) { workerInstance.onmessage = function(e) {
// let data = e.data; // let data = e.data;
console.log("receive data from worker.js"); console.log("receive data from worker.ts");
} }
``` ```
```js ```js
// worker.js // worker.ts
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const parentPort = worker.parentPort; const parentPort = worker.parentPort;
parentPort.onmessage = function(e){ parentPort.onmessage = function(e){
// let data = e.data; // let data = e.data;
parentPort.postMessage("receive data from main.js"); parentPort.postMessage("receive data from main thread");
} }
``` ```
...@@ -1806,12 +1806,12 @@ Terminates the worker thread to stop it from receiving messages. ...@@ -1806,12 +1806,12 @@ Terminates the worker thread to stop it from receiving messages.
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
``` ```
```js ```js
// worker.js // worker.ts
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const parentPort = worker.parentPort; const parentPort = worker.parentPort;
parentPort.onmessage = function(e) { parentPort.onmessage = function(e) {
...@@ -1841,17 +1841,17 @@ Defines the event handler to be called when the worker thread receives a message ...@@ -1841,17 +1841,17 @@ Defines the event handler to be called when the worker thread receives a message
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.postMessage("hello world"); workerInstance.postMessage("hello world");
``` ```
```js ```js
// worker.js // worker.ts
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const parentPort = worker.parentPort; const parentPort = worker.parentPort;
parentPort.onmessage = function(e) { parentPort.onmessage = function(e) {
console.log("receive main.js message"); console.log("receive main thread message");
} }
``` ```
...@@ -1872,28 +1872,28 @@ Defines the event handler to be called when the worker thread receives a message ...@@ -1872,28 +1872,28 @@ Defines the event handler to be called when the worker thread receives a message
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------------------ | ---- | ---------- | | ------ | ------------------------------ | ---- | ---------- |
| this | [DedicatedWorkerGlobalScope](#dedicatedworkerglobalscopedeprecated) | Yes | Caller.| | this | [DedicatedWorkerGlobalScope](#dedicatedworkerglobalscopedeprecated) | Yes | Caller.|
| ev | [MessageEvent](#messageeventt) | Yes | Error data.| | ev | [MessageEvent](#messageeventt)| Yes | Error data.|
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
``` ```
```js ```js
// worker.js // worker.ts
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const parentPort = worker.parentPort; const parentPort = worker.parentPort;
parentPort.onmessageerror = function(e) { parentPort.onmessageerror = function(e) {
console.log("worker.js onmessageerror") console.log("worker.ts onmessageerror")
} }
``` ```
## PostMessageOptions ## PostMessageOptions
Specifies the object whose ownership needs to be transferred during data transfer. The object must be **ArrayBuffer**. Defines the object for which the ownership is to be transferred during data transfer. The object must be an **ArrayBuffer** instance. After the ownership is transferred, the object becomes unavailable in the sender and can be used only in the receiver.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -1940,7 +1940,7 @@ Implements event listening. ...@@ -1940,7 +1940,7 @@ Implements event listening.
**Example** **Example**
```js ```js
const workerInstance = new worker.Worker("workers/worker.js"); const workerInstance = new worker.Worker("workers/worker.ts");
workerInstance.addEventListener("alert", (e)=>{ workerInstance.addEventListener("alert", (e)=>{
console.log("alert listener callback"); console.log("alert listener callback");
}) })
...@@ -2010,16 +2010,16 @@ Defines the event handler to be called when an exception occurs during worker ex ...@@ -2010,16 +2010,16 @@ Defines the event handler to be called when an exception occurs during worker ex
**Example** **Example**
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.Worker("workers/worker.js") const workerInstance = new worker.Worker("workers/worker.ts")
``` ```
```js ```js
// worker.js // worker.ts
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const parentPort = worker.parentPort const parentPort = worker.parentPort
parentPort.onerror = function(e){ parentPort.onerror = function(e){
console.log("worker.js onerror") console.log("worker.ts onerror")
} }
``` ```
...@@ -2045,17 +2045,17 @@ Exception: When an object created through a custom class is passed, no serializa ...@@ -2045,17 +2045,17 @@ Exception: When an object created through a custom class is passed, no serializa
> An FA project of API version 9 is used as an example. > An FA project of API version 9 is used as an example.
```js ```js
// main.js // Main thread
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerInstance = new worker.ThreadWorker("workers/worker.js"); const workerInstance = new worker.ThreadWorker("workers/worker.ts");
workerInstance.postMessage("message from main to worker"); workerInstance.postMessage("message from main thread to worker");
workerInstance.onmessage = function(d) { workerInstance.onmessage = function(d) {
// When the worker thread passes obj2, data contains obj2, excluding the Init or SetName method. // When the worker thread passes obj2, data contains obj2, excluding the Init or SetName method.
let data = d.data; let data = d.data;
} }
``` ```
```js ```js
// worker.js // worker.ts
import worker from '@ohos.worker'; import worker from '@ohos.worker';
const workerPort = worker.workerPort; const workerPort = worker.workerPort;
class MyModel { class MyModel {
...@@ -2065,7 +2065,7 @@ class MyModel { ...@@ -2065,7 +2065,7 @@ class MyModel {
} }
} }
workerPort.onmessage = function(d) { workerPort.onmessage = function(d) {
console.log("worker.js onmessage"); console.log("worker.ts onmessage");
let data = d.data; let data = d.data;
let func1 = function() { let func1 = function() {
console.log("post message is function"); console.log("post message is function");
...@@ -2083,27 +2083,28 @@ workerPort.onmessage = function(d) { ...@@ -2083,27 +2083,28 @@ workerPort.onmessage = function(d) {
workerPort.postMessage(obj2); // No serialization error occurs when passing obj2. workerPort.postMessage(obj2); // No serialization error occurs when passing obj2.
} }
workerPort.onmessageerror = function(e) { workerPort.onmessageerror = function(e) {
console.log("worker.js onmessageerror"); console.log("worker.ts onmessageerror");
} }
workerPort.onerror = function(e) { workerPort.onerror = function(e) {
console.log("worker.js onerror"); console.log("worker.ts onerror");
} }
``` ```
### Memory Model ### Memory Model
The worker thread is implemented based on the actor model. In the worker interaction process, the JS main thread can create multiple worker threads, each of which are isolated and transfer data through sequentialization. They complete computing tasks and return the result to the main thread. The worker thread is implemented based on the actor model. In the worker interaction process, the JS main thread can create multiple worker threads, each of which are isolated and transfer data through serialization. They complete computing tasks and return the result to the main thread.
Each actor concurrently processes tasks of the main thread. For each actor, there is a message queue and a single-thread execution module. The message queue receives requests from the main thread and other actors; the single-thread execution module serially processes requests, sends requests to other actors, and creates new actors. These isolated actors use the asynchronous mode and can run concurrently. Each actor concurrently processes tasks of the main thread. For each actor, there is a message queue and a single-thread execution module. The message queue receives requests from the main thread and other actors; the single-thread execution module serially processes requests, sends requests to other actors, and creates new actors. These isolated actors use the asynchronous mode and can run concurrently.
### Precautions ### Precautions
- Currently, a maximum of seven workers can co-exist. - Currently, a maximum of eight workers can co-exist.
- In API version 8 and earlier versions, when the number of **Worker** instances exceeds the upper limit, the error "Too many workers, the number of workers exceeds the maximum." is thrown. - In API version 8 and earlier versions, when the number of **Worker** instances exceeds the upper limit, the error "Too many workers, the number of workers exceeds the maximum." is thrown.
- Since API version 9, when the number of **Worker** instances exceeds the upper limit, the business error "Worker initialization failure, the number of workers exceeds the maximum" is thrown. - Since API version 9, when the number of **Worker** instances exceeds the upper limit, the business error "Worker initialization failure, the number of workers exceeds the maximum." is thrown.
- To proactively destroy a worker thread, you can call **terminate()** or **parentPort.close()** of the newly created **Worker** instance. - To proactively destroy a worker thread, you can call **terminate()** or **parentPort.close()** of the newly created **Worker** instance.
- Since API version 9, if a **Worker** instance in a non-running state (such as destroyed or being destroyed) calls an API, a business error is thrown. - Since API version 9, if a **Worker** instance in a non-running state (such as destroyed or being destroyed) calls an API, a business error is thrown.
- Creating and terminating worker threads consume performance. Therefore, you are advised to manage available workers and reuse them. - Creating and terminating worker threads consume performance. Therefore, you are advised to manage available workers and reuse them.
- Do not use both **new worker.Worker** and **new worker.ThreadWorker** to create a **Worker** project. Otherwise, **Worker** functions abnormally. Since API version 9, you are advised to use [new worker.ThreadWorker](#constructor9). In API version 8 and earlier versions, you are advised to use [new worker.Worker](#constructordeprecated). - Do not use both **new worker.Worker** and **new worker.ThreadWorker** to create a **Worker** project. Otherwise, **Worker** functions abnormally. Since API version 9, you are advised to use [new worker.ThreadWorker](#constructor9). In API version 8 and earlier versions, you are advised to use [new worker.Worker](#constructordeprecated).
- When creating a **Worker** project, do not import any UI construction method (such as .ets file) to the worker thread file (for example, **worker.ts** used in this document). Otherwise, the worker module becomes invalid. To check whether any UI construction method has been imported, decompress the generated HAP file, find **worker.js** in the directory where the worker thread is created, and search for the keyword **View** globally. If the keyword exists, a UI construction method has been packaged in **worker.js**. If this is your case, change the directory level of **src** in the statement **import "xxx" from src** in the worker thread file. - When creating a **Worker** project, do not import any UI construction method (such as .ets file) to the worker thread file (for example, **worker.ts** used in this document). Otherwise, the worker module becomes invalid. To check whether any UI construction method has been imported, decompress the generated HAP file, find **worker.js** in the directory where the worker thread is created, and search for the keyword **View** globally. If the keyword exists, a UI construction method has been packaged in **worker.js**. If this is your case, change the directory level of **src** in the statement **import "xxx" from src** in the worker thread file.
- A maximum of 16 MB data can be transferred during inter-thread communication.
## Sample Code ## Sample Code
> **NOTE**<br> > **NOTE**<br>
...@@ -2111,15 +2112,10 @@ Each actor concurrently processes tasks of the main thread. For each actor, ther ...@@ -2111,15 +2112,10 @@ Each actor concurrently processes tasks of the main thread. For each actor, ther
### FA Model ### FA Model
```js ```js
// main.js (The following assumes that the workers directory and pages directory are at the same level.) // Main thread (The following assumes that the workers directory and pages directory are at the same level.)
import worker from '@ohos.worker'; import worker from '@ohos.worker';
// Create a Worker instance in the main thread. // Create a Worker instance in the main thread.
const workerInstance = new worker.ThreadWorker("workers/worker.ts"); const workerInstance = new worker.ThreadWorker("workers/worker.ts");
// Create either a .json or .ts file.
// const workerInstance = new worker.ThreadWorker("workers/worker.js");
// In versions earlier than API version 9, use the following to create a Worker instance in the main thread.
// const workerInstance = new worker.Worker("workers/worker.js");
// The main thread transfers information to the worker thread. // The main thread transfers information to the worker thread.
workerInstance.postMessage("123"); workerInstance.postMessage("123");
...@@ -2128,7 +2124,7 @@ workerInstance.postMessage("123"); ...@@ -2128,7 +2124,7 @@ workerInstance.postMessage("123");
workerInstance.onmessage = function(e) { workerInstance.onmessage = function(e) {
// data carries the information sent by the worker thread. // data carries the information sent by the worker thread.
let data = e.data; let data = e.data;
console.log("main.js onmessage"); console.log("main thread onmessage");
// Terminate the Worker instance. // Terminate the Worker instance.
workerInstance.terminate(); workerInstance.terminate();
...@@ -2136,7 +2132,7 @@ workerInstance.onmessage = function(e) { ...@@ -2136,7 +2132,7 @@ workerInstance.onmessage = function(e) {
// Call onexit(). // Call onexit().
workerInstance.onexit = function() { workerInstance.onexit = function() {
console.log("main.js terminate"); console.log("main thread terminate");
} }
``` ```
```js ```js
...@@ -2146,9 +2142,6 @@ import worker from '@ohos.worker'; ...@@ -2146,9 +2142,6 @@ import worker from '@ohos.worker';
// Create an object in the worker thread for communicating with the main thread. // Create an object in the worker thread for communicating with the main thread.
const workerPort = worker.workerPort const workerPort = worker.workerPort
// In versions earlier than API version 9, use the following to create an object in the worker thread for communicating with the main thread.
// const parentPort = worker.parentPort
// The worker thread receives information from the main thread. // The worker thread receives information from the main thread.
workerPort.onmessage = function(e) { workerPort.onmessage = function(e) {
// data carries the information sent by the main thread. // data carries the information sent by the main thread.
...@@ -2169,20 +2162,18 @@ Configuration of the **build-profile.json5** file: ...@@ -2169,20 +2162,18 @@ Configuration of the **build-profile.json5** file:
"buildOption": { "buildOption": {
"sourceOption": { "sourceOption": {
"workers": [ "workers": [
"./src/main/ets/MainAbility/workers/worker.ts" "./src/main/ets/entryability/workers/worker.ts"
] ]
} }
} }
``` ```
### Stage Model ### Stage Model
```js ```js
// main.js (The following assumes that the workers directory and pages directory are at different levels.) // Main thread (The following assumes that the workers directory and pages directory are at different levels.)
import worker from '@ohos.worker'; import worker from '@ohos.worker';
// Create a Worker instance in the main thread. // Create a Worker instance in the main thread.
const workerInstance = new worker.ThreadWorker("entry/ets/pages/workers/worker.ts"); const workerInstance = new worker.ThreadWorker("entry/ets/pages/workers/worker.ts");
// Create either a .json or .ts file.
// const workerInstance = new worker.ThreadWorker("entry/ets/pages/workers/worker.js");
// The main thread transfers information to the worker thread. // The main thread transfers information to the worker thread.
workerInstance.postMessage("123"); workerInstance.postMessage("123");
...@@ -2191,14 +2182,14 @@ workerInstance.postMessage("123"); ...@@ -2191,14 +2182,14 @@ workerInstance.postMessage("123");
workerInstance.onmessage = function(e) { workerInstance.onmessage = function(e) {
// data carries the information sent by the worker thread. // data carries the information sent by the worker thread.
let data = e.data; let data = e.data;
console.log("main.js onmessage"); console.log("main thread onmessage");
// Terminate the Worker instance. // Terminate the Worker instance.
workerInstance.terminate(); workerInstance.terminate();
} }
// Call onexit(). // Call onexit().
workerInstance.onexit = function() { workerInstance.onexit = function() {
console.log("main.js terminate"); console.log("main thread terminate");
} }
``` ```
```js ```js
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
- [Gradient Color](ts-universal-attributes-gradient-color.md) - [Gradient Color](ts-universal-attributes-gradient-color.md)
- [Popup Control](ts-universal-attributes-popup.md) - [Popup Control](ts-universal-attributes-popup.md)
- [Menu Control](ts-universal-attributes-menu.md) - [Menu Control](ts-universal-attributes-menu.md)
- [Click Control](ts-universal-attributes-click.md)
- [Focus Control](ts-universal-attributes-focus.md) - [Focus Control](ts-universal-attributes-focus.md)
- [Hover Effect](ts-universal-attributes-hover-effect.md) - [Hover Effect](ts-universal-attributes-hover-effect.md)
- [Component ID](ts-universal-attributes-component-id.md) - [Component ID](ts-universal-attributes-component-id.md)
...@@ -168,3 +167,5 @@ ...@@ -168,3 +167,5 @@
- [Types](ts-types.md) - [Types](ts-types.md)
- Components No Longer Maintained - Components No Longer Maintained
- [GridContainer](ts-container-gridcontainer.md) - [GridContainer](ts-container-gridcontainer.md)
- APIs No Longer Maintained
- [Click Control](ts-universal-attributes-click.md)
\ No newline at end of file
...@@ -14,14 +14,18 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -14,14 +14,18 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ | | ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ |
| duration | number | No | Animation duration, in ms.<br>Default value: **1000**<br>Unit: ms<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>- The maximum animation duration on an ArkTS widget is 1000 ms.<br>- A value less than 1 evaluates to the value **0**.<br>- If the value is of the floating point type, the value is rounded down. If the value is 1.2, the value **1** is used.| | duration | number | No | Animation duration, in ms.<br>Default value: **1000**<br>Unit: ms<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>- The maximum animation duration on an ArkTS widget is 1000 ms.<br>- A value less than 0 evaluates to the value **0**.<br>- Floating-point values will be rounded down to integers. For example, if the value set is 1.2, **1** will be used.|
| tempo | number | No | Animation playback speed. A larger value indicates a higher animation playback speed.<br>The value **0** indicates that no animation is applied.<br>Default value: **1**<br>**NOTE**<br>A value less than 1 evaluates to the value **1**.| | tempo | number | No | Animation playback speed. A larger value indicates a higher animation playback speed.<br>The value **0** indicates that no animation is applied.<br>Default value: **1**<br>**NOTE**<br>A value less than 0 evaluates to the value **1**.|
| curve | string \| [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve)<sup>9+</sup> | No | Animation curve. The default curve is linear.<br>Default value: **Curve.Linear**<br>Since API version 9, this API is supported in ArkTS widgets.| | curve | string \| [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve)<sup>9+</sup> | No | Animation curve. The default curve is linear.<br>Default value: **Curve.Linear**<br>Since API version 9, this API is supported in ArkTS widgets.|
| delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed.<br>Default value: **0**<br>Value range: [0, +∞)<br>**NOTE**<br>A value less than 1 evaluates to the value **0**. If the value is of the floating point type, the value is rounded down. If the value is 1.2, the value **1** is used.| | delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed.<br>Default value: **0**<br>Value range: [0, +∞)<br>**NOTE**<br>- A value less than 0 evaluates to the value **0**.<br>- Floating-point values will be rounded down to integers. For example, if the value set is 1.2, **1** will be used.|
| iterations | number | No | Number of times that the animation is played.<br>Default value: **1**<br>Value range: [-1, +∞)<br>**NOTE**<br>The value **-1** indicates that the animation is played for an unlimited number of times. The value **0** indicates that no animation is applied.| | iterations | number | No | Number of times that the animation is played.<br>Default value: **1**<br>Value range: [-1, +∞)<br>**NOTE**<br>The value **-1** indicates that the animation is played for an unlimited number of times. The value **0** indicates that no animation is applied.|
| playMode | [PlayMode](ts-appendix-enums.md#playmode) | No | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.<br>Default value: **PlayMode.Normal**<br>Since API version 9, this API is supported in ArkTS widgets.| | playMode | [PlayMode](ts-appendix-enums.md#playmode) | No | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.<br>Default value: **PlayMode.Normal**<br>Since API version 9, this API is supported in ArkTS widgets.<br>For details about the restrictions, see **Notes about PlayMode**.|
| onFinish | () => void | No | Callback invoked when the animation playback is complete.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This callback is not invoked when **iterations** is set to **-1**.| | onFinish | () => void | No | Callback invoked when the animation playback is complete.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This callback is not invoked when **iterations** is set to **-1**.|
> **Notes about PlayMode**:
> - **PlayMode.Normal** and **PlayMode.Alternate** are recommended. Under these settings, the first round of the animation is played forwards. If **PlayMode.Reverse** or **PlayMode.AlternateReverse** is used, the first round of the animation is played backwards. In this case, the animation jumps to the end state and then starts from there.
> - When using **PlayMode.Alternate** or **PlayMode.AlternateReverse**, make sure the final state of the animation is the same as the value of the state variable. In other words, make sure the last round of the animation is played forwards. When **PlayMode.Alternate** is used, **iterations** must be set to an odd number. When **PlayMode.AlternateReverse** is used, **iterations** must be set to an even number.
> - **PlayMode.Reverse** is not recommended. Under this setting, the animation jumps to the end state at the beginning, and its final state will be different from the value of the state variable.
## Example ## Example
......
...@@ -40,7 +40,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -40,7 +40,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| minFontSize | number \| string \| [Resource](ts-types.md#resource) | Minimum font size.<br>For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxLines**, or layout constraint settings.<br>Since API version 9, this API is supported in ArkTS widgets. | | minFontSize | number \| string \| [Resource](ts-types.md#resource) | Minimum font size.<br>For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxLines**, or layout constraint settings.<br>Since API version 9, this API is supported in ArkTS widgets. |
| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | Maximum font size.<br>For the setting to take effect, this attribute must be used together with **minFontSize**, **maxLines**, or layout constraint settings.<br>Since API version 9, this API is supported in ArkTS widgets. | | maxFontSize | number \| string \| [Resource](ts-types.md#resource) | Maximum font size.<br>For the setting to take effect, this attribute must be used together with **minFontSize**, **maxLines**, or layout constraint settings.<br>Since API version 9, this API is supported in ArkTS widgets. |
| textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.<br>Default value: **TextCase.Normal**<br>Since API version 9, this API is supported in ArkTS widgets.| | textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.<br>Default value: **TextCase.Normal**<br>Since API version 9, this API is supported in ArkTS widgets.|
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>Default value: **CopyOptions.None**<br>This API is supported in ArkTS widgets.| | copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>Default value: **CopyOptions.None**<br>This API is supported in ArkTS widgets.<br>**NOTE**<br/>When this attribute is set to **CopyOptions.InApp** or **CopyOptions.LocalDevice**, a long press on the text will display a context menu that offers the copy and select-all options.|
> **NOTE** > **NOTE**
> >
......
...@@ -30,7 +30,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -30,7 +30,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Type | Description | | Name | Type | Description |
| ------------ | ------------------------------------------- | ------------------------------------------------------------ | | ------------ | ------------------------------------------- | ------------------------------------------------------------ |
| alignContent | [Alignment](ts-appendix-enums.md#alignment) | Alignment of child components in the container.<br>Default value: **Alignment.Center**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>When this attribute and the universal attribute [align](ts-universal-attributes-location.md) are both set, only the **align** setting takes effect.| | alignContent | [Alignment](ts-appendix-enums.md#alignment) | Alignment of child components in the container.<br>Default value: **Alignment.Center**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>When both this attribute and the universal attribute [align](ts-universal-attributes-location.md) are set, whichever is set last takes effect.|
## Example ## Example
......
...@@ -14,6 +14,10 @@ This component can contain child components. ...@@ -14,6 +14,10 @@ This component can contain child components.
> **NOTE** > **NOTE**
> >
> Built-in components and custom components are allowed, with support for ([if/else](../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)) rendering control. > Built-in components and custom components are allowed, with support for ([if/else](../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)) rendering control.
>
> When the **\<Swiper>** component's **displayMode** attribute is set to **SwiperDisplayMode.AutoLinear** or its **displayCount** attribute is set to **'auto'**, the child component whose **visibility** attribute is set to **None** does not take up space in the viewport, but this does not affect the number of navigation dots.
>
> If the **visibility** attribute of a child component is set to **None** or **Hidden**, it takes up space in the viewport, but is not displayed.
## APIs ## APIs
...@@ -42,11 +46,11 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -42,11 +46,11 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| vertical | boolean | Whether vertical swiping is used.<br>Default value: **false** | | vertical | boolean | Whether vertical swiping is used.<br>Default value: **false** |
| itemSpace | number \| string | Space between child components.<br>Default value: **0**<br>**NOTE**<br>This parameter cannot be set in percentage.| | itemSpace | number \| string | Space between child components.<br>Default value: **0**<br>**NOTE**<br>This parameter cannot be set in percentage.|
| displayMode | SwiperDisplayMode | Mode in which elements are displayed along the main axis. This attribute takes effect only when **displayCount** is not set.<br>Default value: **SwiperDisplayMode.Stretch**| | displayMode | SwiperDisplayMode | Mode in which elements are displayed along the main axis. This attribute takes effect only when **displayCount** is not set.<br>Default value: **SwiperDisplayMode.Stretch**|
| cachedCount<sup>8+</sup> | number | Number of child components to be cached.<br>Default value: **1**<br>**NOTE**<br>**cachedCount** has caching optimized. You are advised not to use it together with [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md).| | cachedCount<sup>8+</sup> | number | Number of child components to be cached.<br>Default value: **1**<br>**NOTE**<br>This attribute applies only when the **\<Swiper>** component uses [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md).|
| disableSwipe<sup>8+</sup> | boolean | Whether to disable the swipe feature.<br>Default value: **false** | | disableSwipe<sup>8+</sup> | boolean | Whether to disable the swipe feature.<br>Default value: **false** |
| curve<sup>8+</sup> | [Curve](ts-appendix-enums.md#curve) \| string | Animation curve. The ease-in/ease-out curve is used by default. For details about common curves, see [Curve](ts-appendix-enums.md#curve). You can also create custom curves (interpolation curve objects) by using the API provided by the [interpolation calculation](../apis/js-apis-curve.md) module.<br>Default value: **Curve.Linear**| | curve<sup>8+</sup> | [Curve](ts-appendix-enums.md#curve) \| string | Animation curve. The ease-in/ease-out curve is used by default. For details about common curves, see [Curve](ts-appendix-enums.md#curve). You can also create custom curves (interpolation curve objects) by using the API provided by the [interpolation calculation](../apis/js-apis-curve.md) module.<br>Default value: **Curve.Linear**|
| indicatorStyle<sup>8+</sup> | {<br>left?: [Length](ts-types.md#length),<br>top?: [Length](ts-types.md#length),<br>right?: [Length](ts-types.md#length),<br>bottom?: [Length](ts-types.md#length),<br>size?: [Length](ts-types.md#length),<br>mask?: boolean,<br>color?: [ResourceColor](ts-types.md),<br>selectedColor?: [ResourceColor](ts-types.md)<br>} | Style of the navigation point indicator.<br>\- **left**: distance between the navigation point indicator and the left edge of the **\<Swiper>** component.<br>\- **top**: distance between the navigation point indicator and the top edge of the **\<Swiper>** component.<br>\- **right**: distance between the navigation point indicator and the right edge of the **\<Swiper>** component.<br>\- **bottom**: distance between the navigation point indicator and the bottom edge of the **\<Swiper>** component.<br>\- **size**: diameter of the navigation point indicator. The value cannot be in percentage. Default value: **6vp**<br>\- **mask**: whether to enable the mask for the navigation point indicator.<br>\- **color**: color of the navigation point indicator.<br>\- **selectedColor**: color of the selected navigation dot.| | indicatorStyle<sup>8+</sup> | {<br>left?: [Length](ts-types.md#length),<br>top?: [Length](ts-types.md#length),<br>right?: [Length](ts-types.md#length),<br>bottom?: [Length](ts-types.md#length),<br>size?: [Length](ts-types.md#length),<br>mask?: boolean,<br>color?: [ResourceColor](ts-types.md),<br>selectedColor?: [ResourceColor](ts-types.md)<br>} | Style of the navigation point indicator.<br>\- **left**: distance between the navigation point indicator and the left edge of the **\<Swiper>** component.<br>\- **top**: distance between the navigation point indicator and the top edge of the **\<Swiper>** component.<br>\- **right**: distance between the navigation point indicator and the right edge of the **\<Swiper>** component.<br>\- **bottom**: distance between the navigation point indicator and the bottom edge of the **\<Swiper>** component.<br>\- **size**: diameter of the navigation point indicator. The value cannot be in percentage. Default value: **6vp**<br>\- **mask**: whether to enable the mask for the navigation point indicator.<br>\- **color**: color of the navigation point indicator.<br>\- **selectedColor**: color of the selected navigation dot.|
| displayCount<sup>8+</sup> | number \| string | Number of elements to display per page.<br>Default value: **1**<br>**NOTE**<br>If the value is of the string type, it can only be **'auto'**, whose display effect is the same as that of **SwiperDisplayMode.AutoLinear**.<br>If the value is of the number type, child components stretch (shrink) on the main axis after the swiper width [deducting the result of itemSpace x (displayCount - 1)] is evenly distributed among them on the main axis.| | displayCount<sup>8+</sup> | number \| string | Number of elements to display per page.<br>Default value: **1**<br>**NOTE**<br>If the value is of the string type, it can only be **'auto'**, whose display effect is the same as that of **SwiperDisplayMode.AutoLinear**.<br>If the value is set to a number less than or equal to 0, the default value **1** is used.<br>If the value is of the number type, child components stretch (shrink) on the main axis after the swiper width [deducting the result of itemSpace x (displayCount - 1)] is evenly distributed among them on the main axis.|
| effectMode<sup>8+</sup> | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Swipe effect. For details, see **EdgeEffect**.<br>Default value: **EdgeEffect.Spring**<br>**NOTE**<br>The spring effect does not take effect when the controller API is called.| | effectMode<sup>8+</sup> | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Swipe effect. For details, see **EdgeEffect**.<br>Default value: **EdgeEffect.Spring**<br>**NOTE**<br>The spring effect does not take effect when the controller API is called.|
## SwiperDisplayMode ## SwiperDisplayMode
......
...@@ -27,7 +27,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -27,7 +27,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| tabBar | string \| Resource \| {<br>icon?: string \| Resource,<br>text?: string \| Resource<br>}<br>\| [CustomBuilder](ts-types.md)<sup>8+</sup> | Content displayed on the tab bar.<br>**CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions).<br>**NOTE**<br>If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image.<br>If the content set exceeds the space provided by the tab bar, it will be clipped.| | tabBar | string \| [Resource](ts-types.md#resource) \| {<br>icon?: string \| [Resource](ts-types.md#resource),<br>text?: string \| [Resource](ts-types.md#resource)<br>}<br>\| [CustomBuilder](ts-types.md)<sup>8+</sup> | Content displayed on the tab bar.<br>**CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions).<br>**NOTE**<br>If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image.<br>If the content set exceeds the space provided by the tab bar, it will be clipped.|
| tabBar<sup>9+</sup> | [SubTabBarStyle](#subtabbarstyle9) \| [BottomTabBarStyle](#bottomtabbarstyle9) | Content displayed on the tab bar.<br>**SubTabBarStyle**: subtab style. It takes text as its input parameter.<br>**BottomTabBarStyle**: bottom and side tab style. It takes text and images as its input parameters.<br>**NOTE**<br>The bottom tab style does not include an underline.<br>When an icon display error occurs, a gray blank block is displayed.| | tabBar<sup>9+</sup> | [SubTabBarStyle](#subtabbarstyle9) \| [BottomTabBarStyle](#bottomtabbarstyle9) | Content displayed on the tab bar.<br>**SubTabBarStyle**: subtab style. It takes text as its input parameter.<br>**BottomTabBarStyle**: bottom and side tab style. It takes text and images as its input parameters.<br>**NOTE**<br>The bottom tab style does not include an underline.<br>When an icon display error occurs, a gray blank block is displayed.|
> **NOTE** > **NOTE**
......
...@@ -22,8 +22,8 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -22,8 +22,8 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| width | string \| number | No| Width of the circle.<br>Default value: **0**| | width | string \| number | No| Width of the circle.<br>Default value: **0**<br>**NOTE**<br>An invalid value is handled as the default value.|
| height | string \| number | No| Height of the circle.<br>Default value: **0**| | height | string \| number | No| Height of the circle.<br>Default value: **0**<br>**NOTE**<br>An invalid value is handled as the default value.|
## Attributes ## Attributes
...@@ -31,19 +31,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -31,19 +31,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| fill | [ResourceColor](ts-types.md) | Color of the fill area.<br>Default value: **Color.Black**<br>Since API version 9, this API is supported in ArkTS widgets.| | fill | [ResourceColor](ts-types.md) | Color of the fill area.<br>Default value: **Color.Black**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| Opacity of the fill area.<br>Default value: **1**<br>Since API version 9, this API is supported in ArkTS widgets.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| Opacity of the fill area.<br>Default value: **1**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| stroke | [ResourceColor](ts-types.md) | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | stroke | [ResourceColor](ts-types.md) | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If the value is invalid, no stroke will be drawn.|
| strokeDashArray | Array&lt;Length&gt; | Stroke dashes.<br>Default value: **[]**<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashArray | Array&lt;Length&gt; | Stroke dashes.<br>Default value: **[]**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeDashOffset | number \| string | Offset of the start point for drawing the stroke.<br>Default value: **0**<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashOffset | number \| string | Offset of the start point for drawing the stroke.<br>Default value: **0**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the stroke.<br>Default value: **LineCapStyle.Butt**<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the stroke.<br>Default value: **LineCapStyle.Butt**<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | Join style of the stroke.<br>Default value: **LineJoinStyle.Miter**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not work for the **\<circle>** component, which does not have corners.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | Join style of the stroke.<br>Default value: **LineJoinStyle.Miter**<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeMiterLimit | number \| string | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join.<br>Default value: **4**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect for the **\<Circle>** component, because it does not have a miter join.| | strokeMiterLimit | number \| string | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join.<br>Default value: **4**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect for the **\<Circle>** component, because it does not have a miter join.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| Stroke opacity.<br>Default value: **1**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| | strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| Stroke opacity.<br>Default value: **1**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. A value less than 0.0 evaluates to the value **0.0**. A value greater than 1.0 evaluates to the value **1.0**. Any other value evaluates to the value **1.0**.|
| strokeWidth | Length | Stroke width.<br>Default value: **1**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.| | strokeWidth | Length | Stroke width.<br>Default value: **1**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.<br>An invalid value is handled as the default value.|
| antiAlias | boolean | Whether anti-aliasing is enabled.<br>Default value: **true**<br>Since API version 9, this API is supported in ArkTS widgets.| | antiAlias | boolean | Whether anti-aliasing is enabled.<br>Default value: **true**<br>Since API version 9, this API is supported in ArkTS widgets.|
## Example ## Example
```ts ```ts
......
...@@ -22,8 +22,10 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -22,8 +22,10 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| width | string \| number | No| Width.<br>Default value: **0**| | width | string \| number | No| Width.<br>Default value: **0**<br>**NOTE**<br>An invalid value is handled as the default value.|
| height | string \| number | No| Height.<br>Default value: **0**| | height | string \| number | No| Height.<br>Default value: **0**<br>**NOTE**<br>An invalid value is handled as the default value.|
## Attributes ## Attributes
...@@ -31,19 +33,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -31,19 +33,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Default Value| Description| | Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| stroke | [ResourceColor](ts-types.md) | - |Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | stroke | [ResourceColor](ts-types.md) | - |Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If the value is invalid, no stroke will be drawn.|
| strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not work for the **\<ellipse>** component, which does not have corners.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not work for the **\<ellipse>** component, which does not have corners.|
| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect for the **\<Ellipse>** component, because it does not have a miter join.| | strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect for the **\<Ellipse>** component, because it does not have a miter join.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| | strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. A value less than 0.0 evaluates to the value **0.0**. A value greater than 1.0 evaluates to the value **1.0**. Any other value evaluates to the value **1.0**.|
| strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.| | strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.<br>An invalid value is handled as the default value.|
| antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.|
## Example ## Example
```ts ```ts
......
...@@ -21,8 +21,9 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -21,8 +21,9 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type| Mandatory| Default Value| Description| | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | string \| number | No| 0 | Width.| | width | string \| number | No| 0 | Width.<br>**NOTE**<br>An invalid value is handled as the default value.|
| height | string \| number | No| 0 | Height.| | height | string \| number | No| 0 | Height.<br>**NOTE**<br>An invalid value is handled as the default value.|
## Attributes ## Attributes
...@@ -31,20 +32,22 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -31,20 +32,22 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Default Value| Description| | Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| startPoint | Array&lt;Length&gt; | [0, 0] | Coordinates (relative coordinates) of the start point of the line, in vp.<br>Since API version 9, this API is supported in ArkTS widgets.| | startPoint | Array&lt;Length&gt; | [0, 0] | Coordinates (relative coordinates) of the start point of the line, in vp.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| endPoint | Array&lt;Length&gt; | [0, 0] | Coordinates (relative coordinates) of the end point of the line, in vp.<br>Since API version 9, this API is supported in ArkTS widgets.| | endPoint | Array&lt;Length&gt; | [0, 0] | Coordinates (relative coordinates) of the end point of the line, in vp.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fill | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect because the **\<Line>** component cannot be used to draw a closed shape.| | fill | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect because the **\<Line>** component cannot be used to draw a closed shape.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect because the **\<Line>** component cannot be used to draw a closed shape.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect because the **\<Line>** component cannot be used to draw a closed shape.|
| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If the value is invalid, no stroke will be drawn.|
| strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not work for the **\<Line>** component, which does not have corners.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not work for the **\<Line>** component, which does not have corners.|
| strokeMiterLimit | number \| string | 4 | Limit value when the sharp angle is drawn as a miter.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect because the **\<Line>** component cannot be used to draw a shape with a sharp angle.| | strokeMiterLimit | number \| string | 4 | Limit value when the sharp angle is drawn as a miter.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute does not take effect because the **\<Line>** component cannot be used to draw a shape with a sharp angle.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| | strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. A value less than 0.0 evaluates to the value **0.0**. A value greater than 1.0 evaluates to the value **1.0**. Any other value evaluates to the value **1.0**.|
| strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.| | strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.<br>An invalid value is handled as the default value.|
| antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.|
## Example ## Example
### Example 1 ### Example 1
......
...@@ -20,10 +20,12 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -20,10 +20,12 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------- | ---- | ----------------------------------- | | -------- | ---------------- | ---- | ------------------------------------------------------------ |
| width | number \| string | No | Width of the rectangle where the path is located.<br>Default value: **0** | | width | number \| string | No | Width of the rectangle where the path is located.<br>Default value: **0**<br>**NOTE**<br>An invalid value is handled as the default value.|
| height | number \| string | No | Height of the rectangle where the path is located.<br>Default value: **0** | | height | number \| string | No | Height of the rectangle where the path is located.<br>Default value: **0**<br>**NOTE**<br>An invalid value is handled as the default value.|
| commands | string | No | Command for drawing the path.<br>Default value: **''**| | commands | string | No | Command for drawing the path.<br>Default value: **''**<br>**NOTE**<br>An invalid value is handled as the default value.|
## Attributes ## Attributes
...@@ -31,17 +33,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -31,17 +33,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Type | Default Value | Description | | Name | Type | Default Value | Description |
| -------- | ----------------------------------- | ---- | ---------------------------------------- | | -------- | ----------------------------------- | ---- | ---------------------------------------- |
| commands | string | '' | Command for drawing the path. The unit is px. For details about how to convert pixel units, see [Pixel Units](ts-pixel-units.md).<br>Since API version 9, this API is supported in ArkTS widgets.| | commands | string | '' | Command for drawing the path. The unit is px. For details about how to convert pixel units, see [Pixel Units](ts-pixel-units.md).<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| stroke | [ResourceColor](ts-types.md) | - |Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | stroke | [ResourceColor](ts-types.md) | - |Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If the value is invalid, no stroke will be drawn.|
| strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>**NOTE**<br>This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute works only when **strokeLineJoin** is set to **LineJoinStyle.Miter**.<br>The value must be greater than or equal to 1.0. If the value is in the [0, 1) range, the value **1.0** will be used. In other cases, the default value will be used.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the stroke.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. A value less than 0.0 evaluates to the value **0.0**. A value greater than 1.0 evaluates to the value **1.0**. Any other value evaluates to the value **1.0**.|
| strokeWidth | Length | 1 | Width of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.| | strokeWidth | Length | 1 | Width of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.<br>An invalid value is handled as the default value.|
| antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.|
The supported commands are as follows: The supported commands are as follows:
......
...@@ -22,8 +22,9 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -22,8 +22,9 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type| Mandatory| Default Value| Description| | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | string \| number | No| 0 | Width.| | width | string \| number | No| 0 | Width.<br>**NOTE**<br>An invalid value is handled as the default value.|
| height | string \| number | No| 0 | Height.| | height | string \| number | No| 0 | Height.<br>**NOTE**<br>An invalid value is handled as the default value.|
## Attributes ## Attributes
...@@ -32,17 +33,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -32,17 +33,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Default Value| Description| | Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| points | Array&lt;Point&gt; | [] | Vertex coordinates of the polygon.<br>Since API version 9, this API is supported in ArkTS widgets.| | points | Array&lt;Point&gt; | [] | Vertex coordinates of the polygon.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If the value is invalid, no stroke will be drawn.|
| strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>**NOTE**<br>This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>**NOTE**<br>This attribute works only when **strokeLineJoin** is set to **LineJoinStyle.Miter**.<br>The value must be greater than or equal to 1.0. If the value is in the [0, 1) range, the value **1.0** will be used. In other cases, the default value will be used.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>**NOTE**<br>The value range is [0.0, 1.0]. A value less than 0.0 evaluates to the value **0.0**. A value greater than 1.0 evaluates to the value **1.0**. Any other value evaluates to the value **1.0**.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.| | strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.<br>An invalid value is handled as the default value.|
| antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.|
## Point ## Point
......
...@@ -22,8 +22,9 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -22,8 +22,9 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type| Mandatory| Default Value| Description| | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | string \| number | No| 0 | Width.| | width | string \| number | No| 0 | Width.<br>**NOTE**<br>An invalid value is handled as the default value.|
| height | string \| number | No| 0 | Height.| | height | string \| number | No| 0 | Height.<br>**NOTE**<br>An invalid value is handled as the default value.|
## Attributes ## Attributes
...@@ -32,18 +33,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -32,18 +33,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Default Value| Description| | Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| points | Array&lt;Point&gt; | [] | List of coordinates that the polyline passes through.<br>Since API version 9, this API is supported in ArkTS widgets.| | points | Array&lt;Point&gt; | [] | List of coordinates that the polyline passes through.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If the value is invalid, no stroke will be drawn.|
| strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>**NOTE**<br>This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute works only when **strokeLineJoin** is set to **LineJoinStyle.Miter**.<br>The value must be greater than or equal to 1.0. If the value is in the [0, 1) range, the value **1.0** will be used. In other cases, the default value will be used.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. A value less than 0.0 evaluates to the value **0.0**. A value greater than 1.0 evaluates to the value **1.0**. Any other value evaluates to the value **1.0**.|
| strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.| | strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.<br>An invalid value is handled as the default value.|
| antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
## Point ## Point
......
...@@ -23,12 +23,11 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -23,12 +23,11 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type| Mandatory| Default Value| Description| | Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| width | string \| number | No| 0 | Width.| | width | string \| number | No| 0 | Width.<br>**NOTE**<br>An invalid value is handled as the default value.|
| height | string \| number | No| 0 | Height.| | height | string \| number | No| 0 | Height.<br>**NOTE**<br>An invalid value is handled as the default value.|
| radius | string \| number \| Array&lt;string \| number&gt; | No| 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.| | radius | string \| number \| Array&lt;string \| number&gt; | No| 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.<br>This attribute works in a similar manner as **radiusWidth**/**radiusHeight**. When they are used together, it takes precedence over **radiusWidth**/**radiusHeight**.<br>**NOTE**<br>An invalid value is handled as the default value.|
| radiusWidth | string \| number | No| 0 | Width of the rounded corner.| | radiusWidth | string \| number | No| 0 | Width of the rounded corner.<br>**NOTE**<br>An invalid value is handled as the default value.|
| radiusHeight | string \| number | No| 0 | Height of the rounded corner.| | radiusHeight | string \| number | No| 0 | Height of the rounded corner.<br>**NOTE**<br>An invalid value is handled as the default value.|
## Attributes ## Attributes
...@@ -36,21 +35,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -36,21 +35,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Default Value| Description| | Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| radiusWidth | string \| number | 0 | Width of the rounded corner. The width and height are the same when only the width is set.<br>Since API version 9, this API is supported in ArkTS widgets.| | radiusWidth | string \| number | 0 | Width of the rounded corner. The width and height are the same when only the width is set.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| radiusHeight | string \| number | 0 | Height of the rounded corner. The width and height are the same only when the height is set.<br>Since API version 9, this API is supported in ArkTS widgets.| | radiusHeight | string \| number | 0 | Height of the rounded corner. The width and height are the same only when the height is set.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| radius | string \| number \| Array&lt;string \| number&gt; | 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.<br>Since API version 9, this API is supported in ArkTS widgets.| | radius | string \| number \| Array&lt;string \| number&gt; | 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If the value is invalid, no stroke will be drawn.|
| strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>**NOTE**<br>This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute works only when **strokeLineJoin** is set to **LineJoinStyle.Miter**.<br>The value must be greater than or equal to 1.0. If the value is in the [0, 1) range, the value **1.0** will be used. In other cases, the default value will be used.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. A value less than 0.0 evaluates to the value **0.0**. A value greater than 1.0 evaluates to the value **1.0**. Any other value evaluates to the value **1.0**.|
| strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.| | strokeWidth | Length | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value cannot be a percentage.<br>An invalid value is handled as the default value.|
| antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
## Example ## Example
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
The **\<Shape>** component is the parent component of the drawing components. The attributes described in this topic are universal attributes supported by all the drawing components. The **\<Shape>** component is the parent component of the drawing components. The attributes described in this topic are universal attributes supported by all the drawing components.
1. Drawing components use **\<Shape>** as their parent to implement the effect similar to SVG. 1. Drawing components use **\<Shape>** as their parent to implement the effect similar to SVG.
2. The **\<Shape>** component is used independently to draw a specific shape. 2. The **\<Shape>** component is used independently to draw a specific shape.
...@@ -36,17 +35,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -36,17 +35,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name| Type| Default Value| Description| | Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| viewPort | {<br>x?: number \| string,<br>y?: number \| string,<br>width?: number \| string,<br>height?: number \| string<br>} | { x:0, y:0, width:0, height:0 } | View port of the shape.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If of the string type, the value cannot be a percentage.| | viewPort | {<br>x?: number \| string,<br>y?: number \| string,<br>width?: number \| string,<br>height?: number \| string<br>} | { x:0, y:0, width:0, height:0 } | View port of the shape.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If of the string type, the value cannot be a percentage.<br>An invalid value is handled as the default value.|
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If the value is invalid, no stroke will be drawn.|
| strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashArray | Array&lt;Length&gt; | [] | Stroke dashes.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>An invalid value is handled as the default value.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.<br>Since API version 9, this API is supported in ArkTS widgets.|
| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>**NOTE**<br>This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute works only when **strokeLineJoin** is set to **LineJoinStyle.Miter**. The value must be greater than or equal to 1.0. If the value is in the [0, 1) range, the value **1.0** will be used. In other cases, the default value will be used.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>**NOTE**<br>The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.<br>Since API version 9, this API is supported in ArkTS widgets.| | strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value range is [0.0, 1.0]. A value less than 0.0 evaluates to the value **0.0**. A value greater than 1.0 evaluates to the value **1.0**. Any other value evaluates to the value **1.0**.|
| strokeWidth | number \| string | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If of the string type, the value cannot be a percentage.| | strokeWidth | number \| string | 1 | Stroke width.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>If of the string type, the value cannot be a percentage.<br>An invalid value is handled as the default value.|
| antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.<br>Since API version 9, this API is supported in ArkTS widgets.|
| mesh<sup>8+</sup> | Array&lt;number&gt;,number,number | [],0,0 | Mesh effect. The first parameter is an array of lengths (column + 1) * (row + 1) * 2, which records the position of each vertex of the distorted bitmap. The second parameter is the number of columns in the mesh matrix. The third parameter is the number of rows in the mesh matrix.<br>Since API version 9, this API is supported in ArkTS widgets.| | mesh<sup>8+</sup> | Array&lt;number&gt;,number,number | [],0,0 | Mesh effect. The first parameter is an array of lengths (column + 1) * (row + 1) * 2, which records the position of each vertex of the distorted bitmap. The second parameter is the number of columns in the mesh matrix. The third parameter is the number of rows in the mesh matrix.<br>Since API version 9, this API is supported in ArkTS widgets.|
......
...@@ -19,14 +19,18 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -19,14 +19,18 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| duration | number | Animation duration, in ms.<br>Default value: **1000**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>- The maximum animation duration on an ArkTS widget is 1000 ms. If the set value exceeds the limit, the value **1000** will be used.| | duration | number | Animation duration, in ms.<br>Default value: **1000**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>- The maximum animation duration on an ArkTS widget is 1000 ms. If the set value exceeds the limit, the value **1000** will be used.<br>- A value less than 0 evaluates to the value **0**.<br>- Floating-point values will be rounded down to integers. For example, if the value set is 1.2, **1** will be used.|
| tempo | number | Animation playback speed. A larger value indicates faster animation playback, and a smaller value indicates slower animation playback. The value **0** means that there is no animation.<br>Default value: **1.0**| | tempo | number | Animation playback speed. A larger value indicates faster animation playback, and a smaller value indicates slower animation playback. The value **0** means that there is no animation.<br>Default value: **1.0**<br>**NOTE**<br>A value less than 0 evaluates to the value **1**.|
| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | Animation curve.<br>Default value: **Curve.Linear**<br>Since API version 9, this API is supported in ArkTS widgets.| | curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | Animation curve.<br>Default value: **Curve.Linear**<br>Since API version 9, this API is supported in ArkTS widgets.|
| delay | number | Delay of animation playback, in ms. By default, the playback is not delayed.<br>Default value: **0**| | delay | number | Delay of animation playback, in ms. By default, the playback is not delayed.<br>Default value: **0**<br>**NOTE**<br>- A value less than 0 evaluates to the value **0**.<br>- Floating-point values will be rounded down to integers. For example, if the value set is 1.2, **1** will be used.|
| iterations | number | Number of times that the animation is played. By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times.<br>Default value: **1**| | iterations | number | Number of times that the animation is played. By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times.<br>Default value: **1**|
| playMode | [PlayMode](ts-appendix-enums.md#playmode) | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.<br>Default value: **PlayMode.Normal**<br>Since API version 9, this API is supported in ArkTS widgets.| | playMode | [PlayMode](ts-appendix-enums.md#playmode) | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.<br>Default value: **PlayMode.Normal**<br>Since API version 9, this API is supported in ArkTS widgets.<br>For details about the restrictions, see **Notes about PlayMode**.|
| onFinish | () =&gt; void | Callback invoked when the animation playback is complete.<br>Since API version 9, this API is supported in ArkTS widgets.| | onFinish | () =&gt; void | Callback invoked when the animation playback is complete.<br>Since API version 9, this API is supported in ArkTS widgets.|
> **Notes about PlayMode**:
> - **PlayMode.Normal** and **PlayMode.Alternate** are recommended. Under these settings, the first round of the animation is played forwards. If **PlayMode.Reverse** or **PlayMode.AlternateReverse** is used, the first round of the animation is played backwards. In this case, the animation jumps to the end state and then starts from there.
> - When using **PlayMode.Alternate** or **PlayMode.AlternateReverse**, make sure the final state of the animation is the same as the value of the state variable. In other words, make sure the last round of the animation is played forwards. When **PlayMode.Alternate** is used, **iterations** must be set to an odd number. When **PlayMode.AlternateReverse** is used, **iterations** must be set to an even number.
> - **PlayMode.Reverse** is not recommended. Under this setting, the animation jumps to the end state at the beginning, and its final state will be different from the value of the state variable.
## Example ## Example
......
...@@ -12,7 +12,7 @@ Click control attributes are used to set whether a component can respond to fing ...@@ -12,7 +12,7 @@ Click control attributes are used to set whether a component can respond to fing
| Name | Type| Description | | Name | Type| Description |
| ----------- | -------- | ------------------------ | | ----------- | -------- | ------------------------ |
| touchable | boolean | Whether the component can respond to finger interactions such as click and touch events.<br>Default value: **true**| | touchable<sup>(deprecated)</sup> | boolean | Whether the component can respond to finger interactions such as click and touch events.<br>Default value: **true**<br>**NOTE**<br>This API is deprecated since API version 9. You are advised to use [hitTestBehavior](ts-universal-attributes-hit-test-behavior.md) instead.|
## Example ## Example
......
...@@ -55,7 +55,7 @@ struct AspectRatioExample { ...@@ -55,7 +55,7 @@ struct AspectRatioExample {
Text(item) Text(item)
.backgroundColor(0xbbb2cb) .backgroundColor(0xbbb2cb)
.fontSize(40) .fontSize(40)
.height(160) .width('100%')
.aspectRatio(1.5) .aspectRatio(1.5)
} }
}, item => item) }, item => item)
...@@ -70,10 +70,12 @@ struct AspectRatioExample { ...@@ -70,10 +70,12 @@ struct AspectRatioExample {
} }
``` ```
**Figure 1** Portrait display<br> **Figure 1** Portrait display
![en-us_image_0000001256978379](figures/en-us_image_0000001256978379.gif) ![en-us_image_0000001256978379](figures/en-us_image_0000001256978379.gif)
**Figure 2** Landscape display<br> **Figure 2** Landscape display
![en-us_image_0000001212218476](figures/en-us_image_0000001212218476.gif) ![en-us_image_0000001212218476](figures/en-us_image_0000001212218476.gif)
```ts ```ts
...@@ -133,4 +135,6 @@ struct DisplayPriorityExample { ...@@ -133,4 +135,6 @@ struct DisplayPriorityExample {
``` ```
Landscape display in containers of different sizes
![en-us_image_0000001212058504](figures/en-us_image_0000001212058504.gif) ![en-us_image_0000001212058504](figures/en-us_image_0000001212058504.gif)
...@@ -12,7 +12,7 @@ You can bind a popup to a component, specifying its content, interaction logic, ...@@ -12,7 +12,7 @@ You can bind a popup to a component, specifying its content, interaction logic,
| Name | Type | Description | | Name | Type | Description |
| --------- | ---------------------------------------- | ---------------------------------------- | | --------- | ---------------------------------------- | ---------------------------------------- |
| bindPopup | show: boolean,<br>popup: [PopupOptions](#popupoptions) \| [CustomPopupOptions](#custompopupoptions8)<sup>8+</sup> | Binds a popup to the component.<br>**show**: whether to show the popup. The default value is **false**, indicating that the popup is hidden.<br>**popup**: parameters of the popup.| | bindPopup | show: boolean,<br>popup: [PopupOptions](#popupoptions) \| [CustomPopupOptions](#custompopupoptions8)<sup>8+</sup> | Binds a popup to the component.<br>**show**: whether to show the popup. The default value is **false**, indicating that the popup is hidden. As the popup can be displayed only after building of all pages is completed, **show** cannot be set to **true** during page building. Otherwise, the display position and shape of the popup will be incorrect.<br>**popup**: parameters of the popup.|
## PopupOptions ## PopupOptions
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
- [NFC Error Codes](errorcode-nfc.md) - [NFC Error Codes](errorcode-nfc.md)
- [RPC Error Codes](errorcode-rpc.md) - [RPC Error Codes](errorcode-rpc.md)
- [Bluetooth Error Codes](errorcode-bluetoothManager.md) - [Bluetooth Error Codes](errorcode-bluetoothManager.md)
- [Wi-Fi Error Codes](errorcode-wifi.md)
- Basic Features - Basic Features
- [Accessibility Error Codes](errorcode-accessibility.md) - [Accessibility Error Codes](errorcode-accessibility.md)
- [FaultLogger Error Codes](errorcode-faultlogger.md) - [FaultLogger Error Codes](errorcode-faultlogger.md)
......
...@@ -220,7 +220,7 @@ Common kernel errors such as memory application and multi-thread processing erro ...@@ -220,7 +220,7 @@ Common kernel errors such as memory application and multi-thread processing erro
**Solution** **Solution**
Ensure sufficient sytem memory. Ensure sufficient system memory.
## 16000051 Network Error ## 16000051 Network Error
......
# Wi-Fi Error Codes
## 2401000 STA Internal Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs an operation related to the station (STA).
**Possible Causes**
1. Communication between the Wi-Fi service and the STA failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the Wi-Fi function again.
2. If the error persists, restart the device.
## 2501000 STA Internal Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs a STA-related operation.
**Possible Causes**
1. Communication between the Wi-Fi service and the STA failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the Wi-Fi function again.
2. If the error persists, restart the device.
## 2501001 STA Disabled
**Error Message**
Wifi is closed.
**Description**
The Wi-Fi STA function is disabled.
**Possible Causes**
The Wi-Fi function is disabled.
**Solution**
Enable the Wi-Fi function.
## 2601000 Hotspot Module Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs a hotspot-related operation.
**Possible Causes**
1. Communication between the Wi-Fi service and the hotspot failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the hotspot again.
2. If the error persists, restart the device.
## 2701000 AP Extension Module Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs a hotspot-related operation.
**Possible Causes**
1. Communication between the Wi-Fi service and the hotspot failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the hotspot again.
2. If the error persists, restart the device.
## 2801000 P2P Module Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs a P2P-related operation.
**Possible Causes**
1. Communication with the Wi-Fi service failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the Wi-Fi function again.
2. If the error persists, restart the device.
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
- [Native XComponent](_o_h___native_x_component.md) - [Native XComponent](_o_h___native_x_component.md)
- [HiLog](_hi_log.md) - [HiLog](_hi_log.md)
- [NativeWindow](_native_window.md) - [NativeWindow](_native_window.md)
- [OH_NativeBuffer](_o_h___native_buffer.md)
- [Drawing](_drawing.md) - [Drawing](_drawing.md)
- [OH_NativeImage](_o_h___native_image.md)
- [NativeVsync](_native_vsync.md)
- [Image](image.md) - [Image](image.md)
- [Rawfile](rawfile.md) - [Rawfile](rawfile.md)
- [MindSpore](_mind_spore.md) - [MindSpore](_mind_spore.md)
...@@ -32,7 +35,10 @@ ...@@ -32,7 +35,10 @@
- [external_window.h](external__window_8h.md) - [external_window.h](external__window_8h.md)
- [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) - [image_pixel_map_napi.h](image__pixel__map__napi_8h.md)
- [log.h](log_8h.md) - [log.h](log_8h.md)
- [native_buffer.h](native__buffer_8h.md)
- [native_image.h](native__image_8h.md)
- [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) - [native_interface_xcomponent.h](native__interface__xcomponent_8h.md)
- [native_vsync.h](native__vsync_8h.md)
- [raw_dir.h](raw__dir_8h.md) - [raw_dir.h](raw__dir_8h.md)
- [raw_file_manager.h](raw__file__manager_8h.md) - [raw_file_manager.h](raw__file__manager_8h.md)
- [raw_file.h](raw__file_8h.md) - [raw_file.h](raw__file_8h.md)
...@@ -58,6 +64,7 @@ ...@@ -58,6 +64,7 @@
- [native_huks_type.h](native__huks__type_8h.md) - [native_huks_type.h](native__huks__type_8h.md)
- Structs - Structs
- [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) - [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)
- [OH_NativeBuffer_Config](_o_h___native_buffer___config.md)
- [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) - [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)
- [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) - [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md)
- [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) - [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md)
...@@ -65,7 +72,6 @@ ...@@ -65,7 +72,6 @@
- [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) - [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md)
- [OHExtDataHandle](_o_h_ext_data_handle.md) - [OHExtDataHandle](_o_h_ext_data_handle.md)
- [OHHDRMetaData](_o_h_h_d_r_meta_data.md) - [OHHDRMetaData](_o_h_h_d_r_meta_data.md)
- [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md)
- [OhosPixelMapInfo](_ohos_pixel_map_info.md) - [OhosPixelMapInfo](_ohos_pixel_map_info.md)
- [RawFileDescriptor](_raw_file_descriptor.md) - [RawFileDescriptor](_raw_file_descriptor.md)
- [Region](_region.md) - [Region](_region.md)
......
# NativeVsync
## Overview
The **NativeVsync** module provides the capabilities of native virtual synchronization (VSync).
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Since**
9
## Summary
### Files
| Name| Description|
| -------- | -------- |
| [native_vsync.h](native__vsync_8h.md) | Declares the functions for obtaining and using native VSync.<br>File to include: &lt;native_vsync/native_vsync.h&gt;|
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync](#oh_nativevsync) | Provides the declaration of an **OH_NativeVSync** struct. |
| (\*[OH_NativeVSync_FrameCallback](#oh_nativevsync_framecallback)) (long long timestamp, void \*data) | Defines the pointer to a VSync callback function.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync_Create](#oh_nativevsync_create) (const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.|
| [OH_NativeVSync_Destroy](#oh_nativevsync_destroy) ([OH_NativeVSync](#oh_nativevsync) \*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
| [OH_NativeVSync_RequestFrame](#oh_nativevsync_requestframe) ([OH_NativeVSync](#oh_nativevsync) \*nativeVsync, [OH_NativeVSync_FrameCallback](#oh_nativevsync_framecallback) callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|
## Type Description
### OH_NativeVSync
```
typedef struct OH_NativeVSync OH_NativeVSync
```
**Description**
Provides the declaration of a **OH_NativeVSync** struct.
### OH_NativeVSync_FrameCallback
```
typedef void(* OH_NativeVSync_FrameCallback) (long long timestamp, void *data)
```
**Description**
Defines the pointer to a VSync callback function.
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Parameters**
| Name| Description|
| -------- | -------- |
| timestamp | VSync timestamp.|
| data | User-defined data.|
## Function Description
### OH_NativeVSync_Create()
```
OH_NativeVSync* OH_NativeVSync_Create (const char * name, unsigned int length )
```
**Description**
Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Parameters**
| Name| Description|
| -------- | -------- |
| name | Pointer to the name that associates with an **OH_NativeVSync** instance.|
| length | Length of the name.|
**Returns**
Returns the pointer to an **OH_NativeVSync** instance.
### OH_NativeVSync_Destroy()
```
void OH_NativeVSync_Destroy (OH_NativeVSync * nativeVsync)
```
**Description**
Destroys an **OH_NativeVSync** instance.
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Parameters**
| Name| Description|
| -------- | -------- |
| nativeVsync | Pointer to an **OH_NativeVSync** instance.|
### OH_NativeVSync_RequestFrame()
```
int OH_NativeVSync_RequestFrame (OH_NativeVSync * nativeVsync, OH_NativeVSync_FrameCallback callback, void * data )
```
**Description**
Requests the next VSync signal. When the signal arrives, a callback function is invoked.
\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync
**Parameters**
| Name| Description|
| -------- | -------- |
| nativeVsync | Pointer to an **OH_NativeVSync** instance.|
| callback | Function pointer of the **OH_NativeVSync_FrameCallback** type. This function pointer will be called when the next VSync signal arrives.|
| data | Pointer to the user-defined data struct. The type is void\*.|
**Returns**
Returns **0** if the operation is successful.
# OH_NativeBuffer
## Overview
The **OH_NativeBuffer** module provides the capabilities of **NativeBuffer**. Using the functions provided by this module, you can apply for, use, and release the shared memory, and query its attributes.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Since**
9
## Summary
### Files
| Name| Description|
| -------- | -------- |
| [native_buffer.h](native__buffer_8h.md) | Declares the functions for obtaining and using **NativeBuffer**.<br>File to include: &lt;native_buffer/native_buffer.h&gt; |
### Structs
| Name| Description|
| -------- | -------- |
| [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) | Defines the **OH_NativeBuffer** attribute configuration, which is used when you apply for a new **OH_NativeBuffer** instance or query the attributes of an existing instance.|
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeBuffer](#oh_nativebuffer) | Provides the declaration of an **OH_NativeBuffer** struct.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeBuffer_Alloc](#oh_nativebuffer_alloc) (const [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) \*config) | Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.|
| [OH_NativeBuffer_Reference](#oh_nativebuffer_reference) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Increases the reference count of an **OH_NativeBuffer** instance by 1.|
| [OH_NativeBuffer_Unreference](#oh_nativebuffer_unreference) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Decreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.|
| [OH_NativeBuffer_GetConfig](#oh_nativebuffer_getconfig) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer, [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) \*config) | Obtains the attributes of an **OH_NativeBuffer** instance.|
| [OH_NativeBuffer_Map](#oh_nativebuffer_map) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer, void \*\*virAddr) | Maps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.|
| [OH_NativeBuffer_Unmap](#oh_nativebuffer_unmap) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Unmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.|
| [OH_NativeBuffer_GetSeqNum](#oh_nativebuffer_getseqnum) ([OH_NativeBuffer](#oh_nativebuffer) \*buffer) | Obtains the sequence number of an **OH_NativeBuffer** instance.|
## Type Description
### OH_NativeBuffer
```
typedef struct OH_NativeBuffer OH_NativeBuffer
```
**Description**
Provides the declaration of an **OH_NativeBuffer** struct.
## Function Description
### OH_NativeBuffer_Alloc()
```
OH_NativeBuffer* OH_NativeBuffer_Alloc (const OH_NativeBuffer_Config * config)
```
**Description**
Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| config | Pointer to an **OH_NativeBuffer_Config** instance.|
**Returns**
Returns the pointer to the **OH_NativeBuffer** instance created if the operation is successful; returns **NULL** otherwise.
### OH_NativeBuffer_GetConfig()
```
void OH_NativeBuffer_GetConfig (OH_NativeBuffer * buffer, OH_NativeBuffer_Config * config )
```
**Description**
Obtains the attributes of an **OH_NativeBuffer** instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
| config | Pointer to an **OH_NativeBuffer_Config** instance, which is used to receive the attributes of **OH_NativeBuffer**.|
### OH_NativeBuffer_GetSeqNum()
```
uint32_t OH_NativeBuffer_GetSeqNum (OH_NativeBuffer * buffer)
```
**Description**
Obtains the sequence number of an **OH_NativeBuffer** instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
**Returns**
Returns the unique sequence number of the **OH_NativeBuffer** instance.
### OH_NativeBuffer_Map()
```
int32_t OH_NativeBuffer_Map (OH_NativeBuffer * buffer, void ** virAddr )
```
**Description**
Maps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
| virAddr | Double pointer to the address of the virtual memory.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeBuffer_Reference()
```
int32_t OH_NativeBuffer_Reference (OH_NativeBuffer * buffer)
```
**Description**
Increases the reference count of an **OH_NativeBuffer** instance by 1.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeBuffer_Unmap()
```
int32_t OH_NativeBuffer_Unmap (OH_NativeBuffer * buffer)
```
**Description**
Unmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeBuffer_Unreference()
```
int32_t OH_NativeBuffer_Unreference (OH_NativeBuffer * buffer)
```
**Description**
Decreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Parameters**
| Name| Description|
| -------- | -------- |
| buffer | Pointer to an **OH_NativeBuffer** instance.|
**Returns**
Returns **0** if the operation is successful.
# OH_NativeBuffer_Config
## Overview
The **OH_NativeBuffer_Config** struct defines the **OH_NativeBuffer** attribute configuration, which is used when you apply for a new **OH_NativeBuffer** instance or query the attributes of an existing instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer
**Since**
9
**Related Modules**
[OH_NativeBuffer](_o_h___native_buffer.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| width | Width, in pixels.|
| height | Height, in pixels.|
| format | Pixel map format.|
| usage | Description of the buffer usage.|
# OH_NativeImage
## Overview
The **OH_NativeImage** module provides the capabilities of **NativeImage**. Functioning as a data consumer, it is used to associate data with the OpenGL texture. It is used in the OpenGL environment.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Since**
9
## Summary
### Files
| Name| Description|
| -------- | -------- |
| [native_image.h](native__image_8h.md) | Defines the functions for obtaining and using **NativeImage**.<br>File to include: &lt;native_image/native_image.h&gt; |
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeImage](#oh_nativeimage) | Provides the declaration of an **OH_NativeImage** struct.|
| [OHNativeWindow](#ohnativewindow) | Provides the capability of accessing the **NativeWindow**.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeImage_Create](#oh_nativeimage_create) (uint32_t textureId, uint32_t textureTarget) | Creates an **OH_NativeImage** instance to be associated with the OpenGL ES texture ID and target.|
| [OH_NativeImage_AcquireNativeWindow](#oh_nativeimage_acquirenativewindow) (OH_NativeImage \*image) | Obtains an **OHNativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **OHNativeWindow** instance when it is no longer required. |
| [OH_NativeImage_AttachContext](#oh_nativeimage_attachcontext) (OH_NativeImage \*image, uint32_t textureId) | Attaches an **OH_NativeImage** instance to the current OpenGL ES context.<br>The OpenGL ES texture will be bound to an **GL_TEXTURE_EXTERNAL_OES** instance and updated through the **OH_NativeImage** instance.|
| [OH_NativeImage_DetachContext](#oh_nativeimage_detachcontext) (OH_NativeImage \*image) | Detaches an **OH_NativeImage** instance from the current OpenGL ES context.|
| [OH_NativeImage_UpdateSurfaceImage](#oh_nativeimage_updatesurfaceimage) (OH_NativeImage \*image) | Updates the OpenGL ES texture associated with the latest frame through an **OH_NativeImage** instance.|
| [OH_NativeImage_GetTimestamp](#oh_nativeimage_gettimestamp) (OH_NativeImage*image) | Obtains the timestamp of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_GetTransformMatrix](#oh_nativeimage_gettransformmatrix) (OH_NativeImage \*image, float matrix[16]) | Obtains the transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_Destroy](#oh_nativeimage_destroy) (OH_NativeImage \*\*image) | Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**. |
## Type Description
### OH_NativeImage
```
typedef struct OH_NativeImage OH_NativeImage
```
**Description**
Provides the declaration of an **OH_NativeImage** struct.
### OHNativeWindow
```
typedef struct NativeWindow OHNativeWindow
```
**Description**
Provides the capability of accessing the **NativeWindow**.
## Function Description
### OH_NativeImage_AcquireNativeWindow()
```
OHNativeWindow* OH_NativeImage_AcquireNativeWindow (OH_NativeImage * image)
```
**Description**
Obtains an **OHNativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **OHNativeWindow** instance when it is no longer required.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
**Returns**
Returns a pointer to the **OHNativeWindow** instance if the operation is successful; returns **NULL** otherwise.
### OH_NativeImage_AttachContext()
```
int32_t OH_NativeImage_AttachContext (OH_NativeImage * image, uint32_t textureId )
```
**Description**
Attaches an **OH_NativeImage** instance to the current OpenGL ES context.
The OpenGL ES texture will be bound to an **GL_TEXTURE_EXTERNAL_OES** instance and updated through the **OH_NativeImage** instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
| textureId | ID of the OpenGL ES texture to which the **OH_NativeImage** instance is to be attached.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeImage_Create()
```
OH_NativeImage* OH_NativeImage_Create (uint32_t textureId, uint32_t textureTarget )
```
**Description**
Creates an **OH_NativeImage** instance to be associated with the OpenGL ES texture ID and target.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| textureId | OpenGL ES texture ID.|
| textureTarget | OpenGL ES texture target.|
**Returns**
Returns a pointer to the **OH_NativeImage** instance if the operation is successful; returns **NULL** otherwise.
### OH_NativeImage_Destroy()
```
void OH_NativeImage_Destroy (OH_NativeImage ** image)
```
**Description**
Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
### OH_NativeImage_DetachContext()
```
int32_t OH_NativeImage_DetachContext (OH_NativeImage * image)
```
**Description**
Detaches an **OH_NativeImage** instance from the current OpenGL ES context.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeImage_GetTimestamp()
```
int64_t OH_NativeImage_GetTimestamp (OH_NativeImage * image)
```
**Description**
Obtains the timestamp of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
**Returns**
Returns the timestamp of the texture image.
### OH_NativeImage_GetTransformMatrix()
```
int32_t OH_NativeImage_GetTransformMatrix (OH_NativeImage * image, float matrix[16] )
```
**Description**
Obtains the transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
| matrix | Buffer used to store the 4 \* 4 transform matrix obtained.|
**Returns**
Returns **0** if the operation is successful.
### OH_NativeImage_UpdateSurfaceImage()
```
int32_t OH_NativeImage_UpdateSurfaceImage (OH_NativeImage * image)
```
**Description**
Updates the OpenGL ES texture associated with the latest frame through an **OH_NativeImage** instance.
\@syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage
**Parameters**
| Name| Description|
| -------- | -------- |
| image | Pointer to an **OH_NativeImage** instance.|
**Returns**
Returns **0** if the operation is successful.
# OhosPixelMapCreateOps
## Overview
Defines the options used for creating a pixel map.
**Since:**
9
**Related Modules:**
[Image](image.md)
## Summary
### Member Variables
| Name | Description |
| -------- | -------- |
| [width](#width) | Image width, in pixels. |
| [height](#height) | Image height, in pixels. |
| [pixelFormat](#pixelformat) | Image format. |
| [editable](#editable) | Editing type of the image. |
| [alphaType](#alphatype) | Alpha type of the image. |
| [scaleMode](#scalemode) | Scale mode of the image. |
## Member Variable Description
### alphaType
```
uint32_t OhosPixelMapCreateOps::alphaType
```
**Description**<br>
Alpha type of the image.
### editable
```
uint32_t OhosPixelMapCreateOps::editable
```
**Description**<br>
Editing type of the image.
### height
```
uint32_t OhosPixelMapCreateOps::height
```
**Description**<br>
Image height, in pixels.
### pixelFormat
```
int32_t OhosPixelMapCreateOps::pixelFormat
```
**Description**<br>
Image format.
### scaleMode
```
uint32_t OhosPixelMapCreateOps::scaleMode
```
**Description**<br>
Scale mode of the image.
### width
```
uint32_t OhosPixelMapCreateOps::width
```
**Description**<br>
Image width, in pixels.
...@@ -9,6 +9,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. ...@@ -9,6 +9,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required.
**Since** **Since**
8 8
...@@ -19,7 +20,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. ...@@ -19,7 +20,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required.
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | Declares the APIs that can lock, access, and unlock a pixel map.<br>File to include:: <multimedia/image_framework/image_pixel_map_napi.h>| | [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | Declares the APIs that can lock, access, and unlock a pixel map.<br>File to include: <multimedia/image_framework/image_pixel_map_napi.h> |
### Structs ### Structs
...@@ -27,25 +28,14 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. ...@@ -27,25 +28,14 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required.
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| [OhosPixelMapInfo](_ohos_pixel_map_info.md) | Defines the pixel map information.| | [OhosPixelMapInfo](_ohos_pixel_map_info.md) | Defines the pixel map information.|
| [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) | Defines the options used for creating a pixel map.|
### Types ### Types
| Name| Description|
| -------- | -------- |
| [NativePixelMap](#nativepixelmap) | Defines the data type name of the native pixel map.|
### Enums
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| { OHOS_IMAGE_RESULT_SUCCESS = 0, OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by the functions.| | { OHOS_IMAGE_RESULT_SUCCESS = 0, OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by the functions.|
| { OHOS_PIXEL_MAP_FORMAT_NONE = 0, OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3, OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel formats.| | { OHOS_PIXEL_MAP_FORMAT_NONE = 0, OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3, OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel formats.|
| { OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0, OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1, OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2, OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 } | Enumerates the pixel map alpha types.|
| { OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE = 0, OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1 } | Enumerates the pixel map scale modes.|
| { OHOS_PIXEL_MAP_READ_ONLY = 0, OHOS_PIXEL_MAP_EDITABLE = 1 } | Enumerates the pixel map editing types.|
### Functions ### Functions
...@@ -55,44 +45,11 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. ...@@ -55,44 +45,11 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required.
| [OH_GetImageInfo](#oh_getimageinfo) (napi_env env, napi_value value, [OhosPixelMapInfo](_ohos_pixel_map_info.md) \*info) | Obtains the **PixelMap** information and stores the information to the [OhosPixelMapInfo](_ohos_pixel_map_info.md) struct.| | [OH_GetImageInfo](#oh_getimageinfo) (napi_env env, napi_value value, [OhosPixelMapInfo](_ohos_pixel_map_info.md) \*info) | Obtains the **PixelMap** information and stores the information to the [OhosPixelMapInfo](_ohos_pixel_map_info.md) struct.|
| [OH_AccessPixels](#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of a **PixelMap** object and locks the memory.| | [OH_AccessPixels](#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of a **PixelMap** object and locks the memory.|
| [OH_UnAccessPixels](#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of a **PixelMap** object. This function is used with [OH_AccessPixels](#oh_accesspixels) in pairs.| | [OH_UnAccessPixels](#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of a **PixelMap** object. This function is used with [OH_AccessPixels](#oh_accesspixels) in pairs.|
| [OH_PixelMap_CreatePixelMap](#oh_pixelmap_createpixelmap) (napi_env env, [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) info, void \*buf, size_t len, napi_value \*res) | Creates a **PixelMap** object.|
| [OH_PixelMap_CreateAlphaPixelMap](#oh_pixelmap_createalphapixelmap) (napi_env env, napi_value source, napi_value \*alpha) | Creates a **PixelMap** object that contains only alpha channel information.|
| [OH_PixelMap_InitNativePixelMap](#oh_pixelmap_initnativepixelmap) (napi_env env, napi_value source) | Initializes a **PixelMap** object.|
| [OH_PixelMap_GetBytesNumberPerRow](#oh_pixelmap_getbytesnumberperrow) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*num) | Obtains the number of bytes per row of a **PixelMap** object.|
| [OH_PixelMap_GetIsEditable](#oh_pixelmap_getiseditable) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*[editable](image__pixel__map__napi_8h.md#editable)) | Checks whether a **PixelMap** object is editable.|
| [OH_PixelMap_IsSupportAlpha](#oh_pixelmap_issupportalpha) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*alpha) | Checks whether a **PixelMap** object supports alpha channels.|
| [OH_PixelMap_SetAlphaAble](#oh_pixelmap_setalphaable) (const [NativePixelMap](#nativepixelmap) \*native, int32_t alpha) | Sets an alpha channel for a **PixelMap** object.|
| [OH_PixelMap_GetDensity](#oh_pixelmap_getdensity) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*density) | Obtains the pixel density of a **PixelMap** object.|
| [OH_PixelMap_SetDensity](#oh_pixelmap_setdensity) (const [NativePixelMap](#nativepixelmap) \*native, int32_t density) | Sets the pixel density for a **PixelMap** object.|
| [OH_PixelMap_SetOpacity](#oh_pixelmap_setopacity) (const [NativePixelMap](#nativepixelmap) \*native, float opacity) | Sets the opacity for a **PixelMap** object.|
| [OH_PixelMap_Scale](#oh_pixelmap_scale) (const [NativePixelMap](#nativepixelmap) \*native, float x, float y) | Scales a **PixelMap** object.|
| [OH_PixelMap_Translate](#oh_pixelmap_translate) (const [NativePixelMap](#nativepixelmap) \*native, float x, float y) | Translates a **PixelMap** object.|
| [OH_PixelMap_Rotate](#oh_pixelmap_rotate) (const [NativePixelMap](#nativepixelmap) \*native, float angle) | Rotates a **PixelMap** object.|
| [OH_PixelMap_Flip](#oh_pixelmap_flip) (const [NativePixelMap](#nativepixelmap) \*native, int32_t x, int32_t y) | Flips a **PixelMap** object.|
| [OH_PixelMap_Crop](#oh_pixelmap_crop) (const [NativePixelMap](#nativepixelmap) \*native, int32_t x, int32_t y, int32_t [width](image__pixel__map__napi_8h.md#width), int32_t [height](image__pixel__map__napi_8h.md#height)) | Crops a **PixelMap** object.|
## Type Description ## Type Description
### NativePixelMap
```
typedef struct NativePixelMap
```
**Description**
Defines the data type name of the native pixel map.
**Since**
9
## Enum Description
### anonymous enum ### anonymous enum
...@@ -132,68 +89,7 @@ Enumerates the pixel formats. ...@@ -132,68 +89,7 @@ Enumerates the pixel formats.
8 8
### anonymous enum ## anonymous enum
```
anonymous enum
```
**Description**
Enumerates the pixel map alpha types.
| Value| Description|
| -------- | -------- |
| OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN| Unknown format.|
| OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE| Opaque format.|
| OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL| Premultiplied format.|
| OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL| Unpremultiplied format.|
**Since**
9
### anonymous enum
```
anonymous enum
```
**Description**
Enumerates the pixel map scale modes.
| Value| Description|
| -------- | -------- |
| OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE| Adaptation to the target image size.|
| OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP| Cropping the center portion of an image to the target size.|
**Since**
9
### anonymous enum
```
anonymous enum
```
**Description**
Enumerates the pixel map editing types.
| Value| Description|
| -------- | -------- |
| OHOS_PIXEL_MAP_READ_ONLY| Read-only.|
| OHOS_PIXEL_MAP_EDITABLE| Editable.|
**Since**
9
## Function Description
### OH_AccessPixels() ### OH_AccessPixels()
...@@ -258,467 +154,6 @@ Returns **0** if the information is obtained and stored successfully; returns an ...@@ -258,467 +154,6 @@ Returns **0** if the information is obtained and stored successfully; returns an
8 8
### OH_PixelMap_CreateAlphaPixelMap()
```
int32_t OH_PixelMap_CreateAlphaPixelMap (napi_env env, napi_value source, napi_value * alpha )
```
**Description**
Creates a **PixelMap** object that contains only alpha channel information.
**Parameters**
| Name| Description|
| -------- | -------- |
| env | Indicates the NAPI environment pointer.|
| source | Indicates the options for setting the **PixelMap** object.|
| alpha | Indicates the pointer to the alpha channel.|
**Returns**
Returns a **PixelMap** object if the operation is successful; returns an error code otherwise.
**See**
CreateAlphaPixelMap
**Since**
9
### OH_PixelMap_CreatePixelMap()
```
int32_t OH_PixelMap_CreatePixelMap (napi_env env, OhosPixelMapCreateOps info, void * buf, size_t len, napi_value * res )
```
**Description**
Creates a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| env | Indicates the NAPI environment pointer.|
| info | Indicates the options for setting the **PixelMap** object.|
| buf | Indicates the pointer to the buffer of the image.|
| len | Indicates the image size.|
| res | Indicates the pointer to the **PixelMap** object at the application layer.|
**Returns**
Returns a **PixelMap** object if the operation is successful; returns an error code otherwise.
**See**
CreatePixelMap
**Since**
9
### OH_PixelMap_Crop()
```
int32_t OH_PixelMap_Crop (const NativePixelMap * native, int32_t x, int32_t y, int32_t width, int32_t height )
```
**Description**
Crops a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| x | Indicates the x-coordinate of the upper left corner of the target image.|
| y | Indicates the y-coordinate of the upper left corner of the target image.|
| width | Indicates the width of the cropped region.|
| height | Indicates the height of the cropped region.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Crop
**Since**
9
### OH_PixelMap_Flip()
```
int32_t OH_PixelMap_Flip (const NativePixelMap * native, int32_t x, int32_t y )
```
**Description**
Flips a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| x | Specifies whether to flip around the x axis.|
| y | Specifies whether to flip around the y axis.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Flip
**Since**
9
### OH_PixelMap_GetBytesNumberPerRow()
```
int32_t OH_PixelMap_GetBytesNumberPerRow (const NativePixelMap * native, int32_t * num )
```
**Description**
Obtains the number of bytes per row of a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| num | Indicates the pointer to the number of bytes per row of the **PixelMap** object.|
**Returns**
Returns the number of bytes per row of the **PixelMap** object if the operation is successful; returns an error code otherwise.
**See**
GetBytesNumberPerRow
**Since**
9
### OH_PixelMap_GetDensity()
```
int32_t OH_PixelMap_GetDensity (const NativePixelMap * native, int32_t * density )
```
**Description**
Obtains the pixel density of a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| density | Indicates the pointer to the pixel density.|
**Returns**
Returns the pixel density if the operation is successful; returns an error code otherwise.
**See**
GetDensity
**Since**
9
### OH_PixelMap_GetIsEditable()
```
int32_t OH_PixelMap_GetIsEditable (const NativePixelMap * native, int32_t * editable )
```
**Description**
Checks whether a **PixelMap** object is editable.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| editable | Indicates the pointer to the editing type of the **PixelMap** object.|
**Returns**
Returns an enumerated value that indicates the editing type of the **PixelMap** object if the operation is successful; returns an error code otherwise.
**See**
GetIsEditable
**Since**
9
### OH_PixelMap_InitNativePixelMap()
```
NativePixelMap* OH_PixelMap_InitNativePixelMap (napi_env env, napi_value source )
```
**Description**
Initializes a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| env | Indicates the NAPI environment pointer.|
| source | Indicates the options for setting the **PixelMap** object.|
**Returns**
Returns a pointer to the **NativePixelMap** object if the operation is successful; returns an error code otherwise.
**See**
InitNativePixelMap
**Since**
9
### OH_PixelMap_IsSupportAlpha()
```
int32_t OH_PixelMap_IsSupportAlpha (const NativePixelMap * native, int32_t * alpha )
```
**Description**
Checks whether a **PixelMap** object supports alpha channels.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| alpha | Indicates the pointer to the support for alpha channels.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
IsSupportAlpha
**Since**
9
### OH_PixelMap_Rotate()
```
int32_t OH_PixelMap_Rotate (const NativePixelMap * native, float angle )
```
**Description**
Rotates a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| angle | Indicates the angle to rotate.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Rotate
**Since**
9
### OH_PixelMap_Scale()
```
int32_t OH_PixelMap_Scale (const NativePixelMap * native, float x, float y )
```
**Description**
Scales a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| x | Indicates the scaling ratio of the width.|
| y | Indicates the scaling ratio of the height.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Scale
**Since**
9
### OH_PixelMap_SetAlphaAble()
```
int32_t OH_PixelMap_SetAlphaAble (const NativePixelMap * native, int32_t alpha )
```
**Description**
Sets an alpha channel for a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| alpha | Indicates the alpha channel to set.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
SetAlphaAble
**Since**
9
### OH_PixelMap_SetDensity()
```
int32_t OH_PixelMap_SetDensity (const NativePixelMap * native, int32_t density )
```
**Description**
Sets the pixel density for a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| density | Indicates the pixel density to set.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
GetDensity
**Since**
9
### OH_PixelMap_SetOpacity()
```
int32_t OH_PixelMap_SetOpacity (const NativePixelMap * native, float opacity )
```
**Description**
Sets the opacity for a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| opacity | Indicates the opacity to set.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
SetOpacity
**Since**
9
### OH_PixelMap_Translate()
```
int32_t OH_PixelMap_Translate (const NativePixelMap * native, float x, float y )
```
**Description**
Translates a **PixelMap** object.
**Parameters**
| Name| Description|
| -------- | -------- |
| native | Indicates the pointer to a **NativePixelMap** object.|
| x | Indicates the horizontal distance to translate.|
| y | Indicates the vertical distance to translate.|
**Returns**
Returns **0** if the operation is successful; returns an error code otherwise.
**See**
Translate
**Since**
9
### OH_UnAccessPixels() ### OH_UnAccessPixels()
...@@ -747,3 +182,4 @@ AccessPixels ...@@ -747,3 +182,4 @@ AccessPixels
**Since** **Since**
8 8
...@@ -21,13 +21,7 @@ Declares the APIs that can lock, access, and unlock pixel map data. ...@@ -21,13 +21,7 @@ Declares the APIs that can lock, access, and unlock pixel map data.
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| [OhosPixelMapInfo](_ohos_pixel_map_info.md) | Defines the pixel map information. | | [OhosPixelMapInfo](_ohos_pixel_map_info.md) | Defines the pixel map information. |
| [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) |Defines the options used for creating a pixel map. |
### Types
| Name | Description |
| -------- | -------- |
| [NativePixelMap](image.md#nativepixelmap) | Defines the data type name of the native pixel map. |
### Enums ### Enums
...@@ -35,9 +29,6 @@ Declares the APIs that can lock, access, and unlock pixel map data. ...@@ -35,9 +29,6 @@ Declares the APIs that can lock, access, and unlock pixel map data.
| -------- | -------- | | -------- | -------- |
| { OHOS_IMAGE_RESULT_SUCCESS = 0, OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by a function. | | { OHOS_IMAGE_RESULT_SUCCESS = 0, OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by a function. |
| { OHOS_PIXEL_MAP_FORMAT_NONE = 0, OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3, OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel formats. | | { OHOS_PIXEL_MAP_FORMAT_NONE = 0, OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3, OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel formats. |
| { OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0, OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1, OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2, OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 } | Enumerates the pixel map alpha types. |
| { OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE = 0, OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1 } | Enumerates the pixel map scale modes. |
| { OHOS_PIXEL_MAP_READ_ONLY = 0, OHOS_PIXEL_MAP_EDITABLE = 1 } | Enumerates the pixel map editing types. |
### Functions ### Functions
...@@ -48,77 +39,3 @@ Declares the APIs that can lock, access, and unlock pixel map data. ...@@ -48,77 +39,3 @@ Declares the APIs that can lock, access, and unlock pixel map data.
| [OH_AccessPixels](image.md#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of the **PixelMap** object data and locks the memory. | | [OH_AccessPixels](image.md#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of the **PixelMap** object data and locks the memory. |
| [OH_UnAccessPixels](image.md#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of the **PixelMap** object data. This function is used with [OH_AccessPixels](image.md#oh_accesspixels) in pairs. | | [OH_UnAccessPixels](image.md#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of the **PixelMap** object data. This function is used with [OH_AccessPixels](image.md#oh_accesspixels) in pairs. |
### Variables
| Name | Description |
| -------- | -------- |
| [width](#width) | Image width, in pixels. |
| [height](#height) | Image height, in pixels. |
| [pixelFormat](#pixelformat) | Image format. |
| [editable](#editable) | Editing type of the image. |
| [alphaType](#alphatype) | Alpha type of the image. |
| [scaleMode](#scalemode) | Scale mode of the image. |
## Variable Description
### alphaType
```
uint32_t alphaType
```
**Description:**
Alpha type of the image.
### editable
```
uint32_t editable
```
**Description:**
Editing type of the image.
### height
```
uint32_t height
```
**Description:**
Image height, in pixels.
### pixelFormat
```
int32_t pixelFormat
```
**Description:**
Image format.
### scaleMode
```
uint32_t scaleMode
```
**Description:**
Scale mode of the image.
### width
```
uint32_t width
```
**Description:**
Image width, in pixels.
# native_buffer.h
## Overview
The **native_buffer.h** file declares the functions for obtaining and using **NativeBuffer**.
**Since**
9
**Related Modules**
[OH_NativeBuffer](_o_h___native_buffer.md)
## Summary
### Structs
| Name| Description:|
| -------- | -------- |
| [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) | Defines the **OH_NativeBuffer** attribute configuration, which is used when you apply for a new **OH_NativeBuffer** instance or query the attributes of an existing instance.|
### Types
| Name| Description:|
| -------- | -------- |
| [OH_NativeBuffer](_o_h___native_buffer.md#oh_nativebuffer) | Provides the declaration of an **OH_NativeBuffer** struct.|
### Functions
| Name| Description:|
| -------- | -------- |
| [OH_NativeBuffer_Alloc](_o_h___native_buffer.md#oh_nativebuffer_alloc) (const OH_NativeBuffer_Config \*config) | Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.|
| [OH_NativeBuffer_Reference](_o_h___native_buffer.md#oh_nativebuffer_reference) (OH_NativeBuffer \*buffer) | Increases the reference count of an **OH_NativeBuffer** instance by 1.|
| [OH_NativeBuffer_Unreference](_o_h___native_buffer.md#oh_nativebuffer_unreference) (OH_NativeBuffer \*buffer) | Decreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.|
| [OH_NativeBuffer_GetConfig](_o_h___native_buffer.md#oh_nativebuffer_getconfig) (OH_NativeBuffer \*buffer, OH_NativeBuffer_Config \*config) | Obtains the attributes of an **OH_NativeBuffer** instance.|
| [OH_NativeBuffer_Map](_o_h___native_buffer.md#oh_nativebuffer_map) (OH_NativeBuffer \*buffer, void \*\*virAddr) | Maps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.|
| [OH_NativeBuffer_Unmap](_o_h___native_buffer.md#oh_nativebuffer_unmap) (OH_NativeBuffer \*buffer) | Unmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.|
| [OH_NativeBuffer_GetSeqNum](_o_h___native_buffer.md#oh_nativebuffer_getseqnum) (OH_NativeBuffer \*buffer) | Obtains the sequence number of an **OH_NativeBuffer** instance.|
# native_image.h
## Overview
The **native_image.h** file declares the functions for obtaining and using **NativeImage**.
**Since**
9
**Related Modules**
[OH_NativeImage](_o_h___native_image.md)
## Summary
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeImage](_o_h___native_image.md#oh_nativeimage) | Provides the declaration of an **OH_NativeImage** struct.|
| [OHNativeWindow](_o_h___native_image.md#ohnativewindow) | Provides the capability of accessing the **NativeWindow**.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeImage_Create](_o_h___native_image.md#oh_nativeimage_create) (uint32_t textureId, uint32_t textureTarget) | Creates an **OH_NativeImage** instance to be associated with the OpenGL ES texture ID and target.|
| [OH_NativeImage_AcquireNativeWindow](_o_h___native_image.md#oh_nativeimage_acquirenativewindow) (OH_NativeImage \*image) | Obtains an **OHNativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **OHNativeWindow** instance when it is no longer required. |
| [OH_NativeImage_AttachContext](_o_h___native_image.md#oh_nativeimage_attachcontext) (OH_NativeImage \*image, uint32_t textureId) | Attaches an **OH_NativeImage** instance to the current OpenGL ES context.<br>The OpenGL ES texture will be bound to an **GL_TEXTURE_EXTERNAL_OES** instance and updated through the **OH_NativeImage** instance.|
| [OH_NativeImage_DetachContext](_o_h___native_image.md#oh_nativeimage_detachcontext) (OH_NativeImage \*image) | Detaches an **OH_NativeImage** instance from the current OpenGL ES context.|
| [OH_NativeImage_UpdateSurfaceImage](_o_h___native_image.md#oh_nativeimage_updatesurfaceimage) (OH_NativeImage \*image) | Updates the OpenGL ES texture associated with the latest frame through an **OH_NativeImage** instance.|
| [OH_NativeImage_GetTimestamp](_o_h___native_image.md#oh_nativeimage_gettimestamp) (OH_NativeImage \*image) | Obtains the timestamp of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_GetTransformMatrix](_o_h___native_image.md#oh_nativeimage_gettransformmatrix) (OH_NativeImage \*image, float matrix[16]) | Obtains the transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_Destroy](_o_h___native_image.md#oh_nativeimage_destroy) (OH_NativeImage \*\*image) | Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**. |
# native_vsync.h
## Overview
The **native_vsync.h** file declares the functions for obtaining and using native virtual synchronization (VSync).
**Since**
9
**Related Modules**
[NativeVsync](_native_vsync.md)
## Summary
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync](_native_vsync.md#oh_nativevsync) | Provides the declaration of an **OH_NativeVSync** struct. |
| (\*[OH_NativeVSync_FrameCallback](_native_vsync.md#oh_nativevsync_framecallback)) (long long timestamp, void \*data) | Defines the pointer to a VSync callback function.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync_Create](_native_vsync.md#oh_nativevsync_create) (const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.|
| [OH_NativeVSync_Destroy](_native_vsync.md#oh_nativevsync_destroy) (OH_NativeVSync \*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
| [OH_NativeVSync_RequestFrame](_native_vsync.md#oh_nativevsync_requestframe) (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|
...@@ -125,7 +125,7 @@ User authorization is required when an application needs to access user privacy ...@@ -125,7 +125,7 @@ User authorization is required when an application needs to access user privacy
> **NOTE** > **NOTE**
> >
> Each time before an API protected by a **user_grant** permission is called, **requestPermissionsFromUser()** will be called to request user authorization. After the permission is granted, the user may revoke the authorization in **Settings**. Therefore, the previous authorization status cannot be persistent. > Each time before an API protected by a **user_grant** permission is called, **[requestPermissionsFromUser()](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9)** will be called to request user authorization. After the permission is granted, the user may revoke the authorization in **Settings**. Therefore, the previous authorization status cannot be persistent.
### Stage Model ### Stage Model
......
...@@ -39,10 +39,14 @@ The figure below illustrates the process. ...@@ -39,10 +39,14 @@ The figure below illustrates the process.
![](figures/permission-workflow.png) ![](figures/permission-workflow.png)
**NOTE**
1. Refer to the figure below to determine whether an application can apply for a permission. 1. Refer to the figure below to determine whether an application can apply for a permission.
![](figures/permission-application-process.png) ![](figures/permission-application-process.png)
**NOTE**
1. See [Permission Levels](#permission-levels) for details about the mapping between the application Ability Privilege Level (APL) and the permission level. 1. See [Permission Levels](#permission-levels) for details about the mapping between the application Ability Privilege Level (APL) and the permission level.
2. The permission authorization modes include user_grant (permission granted by the user) and system_grant (permission granted by the system). For details, see [Permission Types](#permission-types). 2. The permission authorization modes include user_grant (permission granted by the user) and system_grant (permission granted by the system). For details, see [Permission Types](#permission-types).
...@@ -58,6 +62,8 @@ The figure below shows the permission verification process. ...@@ -58,6 +62,8 @@ The figure below shows the permission verification process.
![](figures/permission-verify-process.png) ![](figures/permission-verify-process.png)
**NOTE**
1: An application permission can be used to control the access to an API that has sensitive data involved or security threats on core abilities. 1: An application permission can be used to control the access to an API that has sensitive data involved or security threats on core abilities.
2: The API can be protected by a permission in the [ACL](#acl). For example, if contact information is involved in an API provided by an application, you can use a contact-related permission to protect the API. 2: The API can be protected by a permission in the [ACL](#acl). For example, if contact information is involved in an API provided by an application, you can use a contact-related permission to protect the API.
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
- Application Configuration Files in FA Model - Application Configuration Files in FA Model
- [Application Configuration File Overview (FA Model)](quick-start/application-configuration-file-overview-fa.md) - [Application Configuration File Overview (FA Model)](quick-start/application-configuration-file-overview-fa.md)
- [Internal Structure of the app Tag](quick-start/app-structure.md) - [Internal Structure of the app Tag](quick-start/app-structure.md)
- [Internal structure of deviceConfig Tag](quick-start/deviceconfig-structure.md) - [Internal Structure of the deviceConfig Tag](quick-start/deviceconfig-structure.md)
- [Internal Structure of the module Tag](quick-start/module-structure.md) - [Internal Structure of the module Tag](quick-start/module-structure.md)
- [Resource Categories and Access](quick-start/resource-categories-and-access.md) - [Resource Categories and Access](quick-start/resource-categories-and-access.md)
- Learning ArkTS - Learning ArkTS
...@@ -47,19 +47,19 @@ ...@@ -47,19 +47,19 @@
- Custom Component - Custom Component
- [Creating a Custom Component](quick-start/arkts-create-custom-components.md) - [Creating a Custom Component](quick-start/arkts-create-custom-components.md)
- [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md) - [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md)
- [\@Builder: Custom Builder Function](quick-start/arkts-builder.md) - [\@Builder Decorator: Custom Builder Function](quick-start/arkts-builder.md)
- [\@BuilderParam: @Builder Function Reference](quick-start/arkts-builderparam.md) - [\@BuilderParam Decorator: \@Builder Function Reference](quick-start/arkts-builderparam.md)
- [\@Styles: Definition of Resusable Styles](quick-start/arkts-style.md) - [\@Styles Decorator: Definition of Resusable Styles](quick-start/arkts-style.md)
- [\@Extend: Extension of Built-in Components](quick-start/arkts-extend.md) - [\@Extend Decorator: Extension of Built-in Components](quick-start/arkts-extend.md)
- [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md) - [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md)
- State Management - State Management
- [State Management Overview](quick-start/arkts-state-management-overview.md) - [State Management Overview](quick-start/arkts-state-management-overview.md)
- Component State Management - Component State Management
- [\@State: State Owned by Component](quick-start/arkts-state.md) - [\@State Decorator: State Owned by Component](quick-start/arkts-state.md)
- [\@Prop: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md) - [\@Prop Decorator: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md)
- [\@Link: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md) - [\@Link Decorator: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md)
- [\@Provide and \@Consume: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.md) - [\@Provide and \@Consume Decorators: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.md)
- [\@Observed and \@ObjectLink: Observing Attribute Changes in Nested Class Objects](quick-start/arkts-observed-and-objectlink.md) - [\@Observed and \@ObjectLink Decorators: Observing Attribute Changes in Nested Class Objects](quick-start/arkts-observed-and-objectlink.md)
- Application State Management - Application State Management
- [Application State Management Overview](quick-start/arkts-application-state-management-overview.md) - [Application State Management Overview](quick-start/arkts-application-state-management-overview.md)
- [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md) - [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md)
...@@ -68,10 +68,10 @@ ...@@ -68,10 +68,10 @@
- [Environment: Device Environment Query](quick-start/arkts-environment.md) - [Environment: Device Environment Query](quick-start/arkts-environment.md)
- Other State Management Features - Other State Management Features
- [Overview of Other State Management Features](quick-start/arkts-other-state-mgmt-functions-overview.md) - [Overview of Other State Management Features](quick-start/arkts-other-state-mgmt-functions-overview.md)
- [\@Watch: Getting Notified of State Variable Changes](quick-start/arkts-watch.md) - [\@Watch Decorator: Getting Notified of State Variable Changes](quick-start/arkts-watch.md)
- [$$ Syntax: Two-Way Synchronization of Built-in Components](quick-start/arkts-two-way-sync.md) - [$$ Syntax: Two-Way Synchronization of Built-in Components](quick-start/arkts-two-way-sync.md)
- Rendering Control - Rendering Control
- [Rendering Control Overview](quick-start/arkts-rendering-control-overview.md) - [Overview of Rendering Control](quick-start/arkts-rendering-control-overview.md)
- [if/else: Conditional Rendering](quick-start/arkts-rendering-control-ifelse.md) - [if/else: Conditional Rendering](quick-start/arkts-rendering-control-ifelse.md)
- [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md) - [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md)
- [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md) - [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md)
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
- [Interpretation of the Application Model](application-models/application-model-description.md) - [Interpretation of the Application Model](application-models/application-model-description.md)
- Stage Model Development - Stage Model Development
- [Stage Model Development Overview](application-models/stage-model-development-overview.md) - [Stage Model Development Overview](application-models/stage-model-development-overview.md)
- Stage Mode Application Components - Stage Model Application Components
- [Application- or Component-Level Configuration](application-models/application-component-configuration-stage.md) - [Application- or Component-Level Configuration](application-models/application-component-configuration-stage.md)
- UIAbility Component - UIAbility Component
- [UIAbility Component Overview](application-models/uiability-overview.md) - [UIAbility Component Overview](application-models/uiability-overview.md)
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
- [Page Stack and MissionList](application-models/page-mission-stack.md) - [Page Stack and MissionList](application-models/page-mission-stack.md)
- FA Model Development - FA Model Development
- [FA Model Development Overview](application-models/fa-model-development-overview.md) - [FA Model Development Overview](application-models/fa-model-development-overview.md)
- FA Mode Application Components - FA Model Application Components
- [Application- or Component-Level Configuration](application-models/application-component-configuration-fa.md) - [Application- or Component-Level Configuration](application-models/application-component-configuration-fa.md)
- PageAbility Component Development - PageAbility Component Development
- [PageAbility Component Overview](application-models/pageability-overview.md) - [PageAbility Component Overview](application-models/pageability-overview.md)
...@@ -241,39 +241,39 @@ ...@@ -241,39 +241,39 @@
- Layout Development - Layout Development
- [Layout Overview](ui/arkts-layout-development-overview.md) - [Layout Overview](ui/arkts-layout-development-overview.md)
- Building a Layout - Building a Layout
- [Linear Layout](ui/arkts-layout-development-linear.md) - [Linear Layout (Row/Column)](ui/arkts-layout-development-linear.md)
- [Stack Layout](ui/arkts-layout-development-stack-layout.md) - [Stack Layout (Stack)](ui/arkts-layout-development-stack-layout.md)
- [Flex Layout](ui/arkts-layout-development-flex-layout.md) - [Flex Layout (Flex)](ui/arkts-layout-development-flex-layout.md)
- [Relative Layout](ui/arkts-layout-development-relative-layout.md) - [Relative Layout (RelativeContainer)](ui/arkts-layout-development-relative-layout.md)
- [Responsive Grid Layout](ui/arkts-layout-development-grid-layout.md) - [Responsive Grid Layout (GridRow/GridCol)](ui/arkts-layout-development-grid-layout.md)
- [Media Query](ui/arkts-layout-development-media-query.md) - [Media Query (mediaquery)](ui/arkts-layout-development-media-query.md)
- [Creating a List](ui/arkts-layout-development-create-list.md) - [Creating a List (List)](ui/arkts-layout-development-create-list.md)
- [Creating a Grid](ui/arkts-layout-development-create-grid.md) - [Creating a Grid (Grid/GridItem)](ui/arkts-layout-development-create-grid.md)
- [Creating a Swiper](ui/arkts-layout-development-create-looping.md) - [Creating a Swiper (Swiper)](ui/arkts-layout-development-create-looping.md)
- [Improving Layout Performance](ui/arkts-layout-development-performance-boost.md) - [Improving Layout Performance](ui/arkts-layout-development-performance-boost.md)
- Adding a Component - Adding a Component
- Adding a Common Component - Adding a Common Component
- [Button](ui/arkts-common-components-button.md) - [Button](ui/arkts-common-components-button.md)
- [Radio Button](ui/arkts-common-components-radio-button.md) - [Radio Button (Radio)](ui/arkts-common-components-radio-button.md)
- [Toggle](ui/arkts-common-components-switch.md) - [Toggle](ui/arkts-common-components-switch.md)
- [Progress Indicator](ui/arkts-common-components-progress-indicator.md) - [Progress Indicator (Progress)](ui/arkts-common-components-progress-indicator.md)
- [Text Display](ui/arkts-common-components-text-display.md) - [Text Display (Text/Span)](ui/arkts-common-components-text-display.md)
- [Text Input](ui/arkts-common-components-text-input.md) - [Text Input (TextInput/TextArea)](ui/arkts-common-components-text-input.md)
- [Custom Dialog Box](ui/arkts-common-components-custom-dialog.md) - [Custom Dialog Box (CustomDialog)](ui/arkts-common-components-custom-dialog.md)
- [Video Playback](ui/arkts-common-components-video-player.md) - [Video Playback (Video)](ui/arkts-common-components-video-player.md)
- [XComponent](ui/arkts-common-components-xcomponent.md) - [XComponent](ui/arkts-common-components-xcomponent.md)
- Adding a Bubble and Menu - Adding a Bubble and Menu
- [Bubble](ui/arkts-popup-and-menu-components-popup.md) - [Bubble (Popup)](ui/arkts-popup-and-menu-components-popup.md)
- [Menu](ui/arkts-popup-and-menu-components-menu.md) - [Menu](ui/arkts-popup-and-menu-components-menu.md)
- Setting Page Routing and Component Navigation - Setting Page Routing and Component Navigation
- [Page Routing](ui/arkts-routing.md) - [Page Routing (router)](ui/arkts-routing.md)
- Component Navigation - Component Navigation
- [Navigation](ui/arkts-navigation-navigation.md) - [Navigation](ui/arkts-navigation-navigation.md)
- [Tabs](ui/arkts-navigation-tabs.md) - [Tabs](ui/arkts-navigation-tabs.md)
- Using Graphics - Using Graphics
- [Displaying Images](ui/arkts-graphics-display.md) - [Displaying Images (Image)](ui/arkts-graphics-display.md)
- [Drawing Geometric Shapes](ui/arkts-geometric-shape-drawing.md) - [Drawing Geometric Shapes (Shape)](ui/arkts-geometric-shape-drawing.md)
- [Drawing Custom Graphics on the Canvas](ui/arkts-drawing-customization-on-canvas.md) - [Drawing Custom Graphics on the Canvas (Canvas)](ui/arkts-drawing-customization-on-canvas.md)
- Using Animation - Using Animation
- [Animation Overview](ui/arkts-animation-overview.md) - [Animation Overview](ui/arkts-animation-overview.md)
- Animation Within a Page - Animation Within a Page
...@@ -294,9 +294,9 @@ ...@@ -294,9 +294,9 @@
- [Single Gesture](ui/arkts-gesture-events-single-gesture.md) - [Single Gesture](ui/arkts-gesture-events-single-gesture.md)
- [Combined Gestures](ui/arkts-gesture-events-combined-gestures.md) - [Combined Gestures](ui/arkts-gesture-events-combined-gestures.md)
- [Recommendations for Improving Performance](ui/arkts-performance-improvement-recommendation.md) - [Recommendations for Improving Performance](ui/arkts-performance-improvement-recommendation.md)
- UI Development (JavaScript-compatible Web-like Development Paradigm) - UI Development with JavaScript-compatible Web-like Development Paradigm
- [UI Development (JavaScript-compatible Web-like Development Paradigm) Overview](ui/ui-js-overview.md) - [UI Development with JavaScript-compatible Web-like Development Paradigm Overview](ui/ui-js-overview.md)
- Framework Overview - Framework
- [File Organization](ui/js-framework-file.md) - [File Organization](ui/js-framework-file.md)
- ["js" Tag](ui/js-framework-js-tag.md) - ["js" Tag](ui/js-framework-js-tag.md)
- [app.js](ui/js-framework-js-file.md) - [app.js](ui/js-framework-js-file.md)
...@@ -347,7 +347,7 @@ ...@@ -347,7 +347,7 @@
- [Canvas](ui/ui-js-components-canvas.md) - [Canvas](ui/ui-js-components-canvas.md)
- [CanvasRenderingContext2D](ui/ui-js-components-canvasrenderingcontext2d.md) - [CanvasRenderingContext2D](ui/ui-js-components-canvasrenderingcontext2d.md)
- [Path2D](ui/ui-js-components-path2d.md) - [Path2D](ui/ui-js-components-path2d.md)
- [OffscreenCanvas](ui/ui-js-components-offscreencanvas.md) - [OffscreenCanvasRenderingContext2D](ui/ui-js-components-offscreencanvas.md)
- [Grid-container Development](ui/ui-js-components-grid.md) - [Grid-container Development](ui/ui-js-components-grid.md)
- Svg - Svg
- [Basics](ui/ui-js-components-svg-overview.md) - [Basics](ui/ui-js-components-svg-overview.md)
...@@ -514,7 +514,7 @@ ...@@ -514,7 +514,7 @@
- Cross-Application Data Sharing (for System Applications Only) - Cross-Application Data Sharing (for System Applications Only)
- [Cross-Application Data Sharing Overview](database/share-device-data-across-apps-overview.md) - [Cross-Application Data Sharing Overview](database/share-device-data-across-apps-overview.md)
- [Sharing Data Using DataShareExtensionAbility](database/share-data-by-datashareextensionability.md) - [Sharing Data Using DataShareExtensionAbility](database/share-data-by-datashareextensionability.md)
- [Sharing Data in Silent Access](database/share-data-by-silent-access.md) - [Data Sharing Through Silent Access](database/share-data-by-silent-access.md)
- File Management - File Management
- [File Management Overview](file-management/file-management-overview.md) - [File Management Overview](file-management/file-management-overview.md)
- Application File - Application File
...@@ -522,7 +522,7 @@ ...@@ -522,7 +522,7 @@
- [Application Sandbox Directory](file-management/app-sandbox-directory.md) - [Application Sandbox Directory](file-management/app-sandbox-directory.md)
- Application File Access and Management - Application File Access and Management
- [Accessing Application Files](file-management/app-file-access.md) - [Accessing Application Files](file-management/app-file-access.md)
- [Uploading and Downloading Application Files](file-management/app-file-upload-download.md) - [Uploading and Downloading an Application File](file-management/app-file-upload-download.md)
- [Obtaining Application and File System Space Statistics](file-management/app-fs-space-statistics.md) - [Obtaining Application and File System Space Statistics](file-management/app-fs-space-statistics.md)
- [Sending Files to an Application Sandbox](file-management/send-file-to-app-sandbox.md) - [Sending Files to an Application Sandbox](file-management/send-file-to-app-sandbox.md)
- [Sharing an Application File](file-management/share-app-file.md) - [Sharing an Application File](file-management/share-app-file.md)
...@@ -531,8 +531,8 @@ ...@@ -531,8 +531,8 @@
- Selecting and Saving User Files (FilePicker) - Selecting and Saving User Files (FilePicker)
- [Selecting User Files](file-management/select-user-file.md) - [Selecting User Files](file-management/select-user-file.md)
- [Saving User Files](file-management/save-user-file.md) - [Saving User Files](file-management/save-user-file.md)
- [Developing a FileManager Application (Available Only for System Applications)](file-management/dev-user-file-manager.md) - [Developing a FileManager Application (for System Applications Only)](file-management/dev-user-file-manager.md)
- [Managing External Storage Devices (Available Only for System Applications)](file-management/manage-external-storage.md) - [Managing External Storage Devices (for System Applications Only)](file-management/manage-external-storage.md)
- Distributed File System - Distributed File System
- [Distributed File System Overview](file-management/distributed-fs-overview.md) - [Distributed File System Overview](file-management/distributed-fs-overview.md)
- [Setting the Security Level of a Distributed File](file-management/set-security-label.md) - [Setting the Security Level of a Distributed File](file-management/set-security-label.md)
...@@ -606,325 +606,15 @@ ...@@ -606,325 +606,15 @@
- Packing and Unpacking Tools - Packing and Unpacking Tools
- [Packing Tools](tools/packing-tool.md) - [Packing Tools](tools/packing-tool.md)
- [Unpacking Tools](tools/unpacking-tool.md) - [Unpacking Tools](tools/unpacking-tool.md)
- [Advanced Notification Manager](tools/cem-tool.md) - [Common Event Manager](tools/cem-tool.md)
- [Common Event Manager](tools/anm-tool.md) - [Advanced Notification Manager](tools/anm-tool.md)
- Hands-On Tutorials - Hands-On Tutorials
- [Samples](https://gitee.com/openharmony/applications_app_samples/blob/OpenHarmony-3.2-Release/README.md) - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/OpenHarmony-3.2-Release/README.md)
- [Codelabs](https://gitee.com/openharmony/codelabs) - [Codelabs](https://gitee.com/openharmony/codelabs)
- API References - API References
- [SystemCapability](reference/syscap.md) - [SystemCapability](reference/syscap.md)
- [SystemCapability List](reference/syscap-list.md) - [SystemCapability List](reference/syscap-list.md)
- Component Reference (ArkTS-based Declarative Development Paradigm) - ArkTS API Reference
- [Component Overview](reference/arkui-ts/ts-components-summary.md)
- Universal Component Information
- Universal Events
- [Click Event](reference/arkui-ts/ts-universal-events-click.md)
- [Touch Event](reference/arkui-ts/ts-universal-events-touch.md)
- [Show/Hide Event](reference/arkui-ts/ts-universal-events-show-hide.md)
- [Drag/Drop Event](reference/arkui-ts/ts-universal-events-drag-drop.md)
- [Key Event](reference/arkui-ts/ts-universal-events-key.md)
- [Focus Event](reference/arkui-ts/ts-universal-focus-event.md)
- [Mouse Event](reference/arkui-ts/ts-universal-mouse-key.md)
- [Component Area Change Event](reference/arkui-ts/ts-universal-component-area-change-event.md)
- [Visible Area Change Event](reference/arkui-ts/ts-universal-component-visible-area-change-event.md)
- Universal Attributes
- [Size](reference/arkui-ts/ts-universal-attributes-size.md)
- [Location](reference/arkui-ts/ts-universal-attributes-location.md)
- [Layout Constraints](reference/arkui-ts/ts-universal-attributes-layout-constraints.md)
- [Flex Layout](reference/arkui-ts/ts-universal-attributes-flex-layout.md)
- [Border](reference/arkui-ts/ts-universal-attributes-border.md)
- [Border Image](reference/arkui-ts/ts-universal-attributes-border-image.md)
- [Background](reference/arkui-ts/ts-universal-attributes-background.md)
- [Opacity](reference/arkui-ts/ts-universal-attributes-opacity.md)
- [Visibility](reference/arkui-ts/ts-universal-attributes-visibility.md)
- [Enable/Disable](reference/arkui-ts/ts-universal-attributes-enable.md)
- [Overlay](reference/arkui-ts/ts-universal-attributes-overlay.md)
- [Z-order Control](reference/arkui-ts/ts-universal-attributes-z-order.md)
- [Transformation](reference/arkui-ts/ts-universal-attributes-transformation.md)
- [Image Effect Configuration](reference/arkui-ts/ts-universal-attributes-image-effect.md)
- [Shape Clipping](reference/arkui-ts/ts-universal-attributes-sharp-clipping.md)
- [Text Style](reference/arkui-ts/ts-universal-attributes-text-style.md)
- [Grid](reference/arkui-ts/ts-universal-attributes-grid.md)
- [Gradient Color](reference/arkui-ts/ts-universal-attributes-gradient-color.md)
- [Popup Control](reference/arkui-ts/ts-universal-attributes-popup.md)
- [Menu Control](reference/arkui-ts/ts-universal-attributes-menu.md)
- [Click Control](reference/arkui-ts/ts-universal-attributes-click.md)
- [Focus Control](reference/arkui-ts/ts-universal-attributes-focus.md)
- [Hover Effect](reference/arkui-ts/ts-universal-attributes-hover-effect.md)
- [Component ID](reference/arkui-ts/ts-universal-attributes-component-id.md)
- [Touch Target](reference/arkui-ts/ts-universal-attributes-touch-target.md)
- [Polymorphic Style](reference/arkui-ts/ts-universal-attributes-polymorphic-style.md)
- [Hit Test Control](reference/arkui-ts/ts-universal-attributes-hit-test-behavior.md)
- [Background Blur](reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md)
- [restoreId](reference/arkui-ts/ts-universal-attributes-restoreId.md)
- Gesture Processing
- [Gesture Binding Methods](reference/arkui-ts/ts-gesture-settings.md)
- Basic Gestures
- [TapGesture](reference/arkui-ts/ts-basic-gestures-tapgesture.md)
- [LongPressGesture](reference/arkui-ts/ts-basic-gestures-longpressgesture.md)
- [PanGesture](reference/arkui-ts/ts-basic-gestures-pangesture.md)
- [PinchGesture](reference/arkui-ts/ts-basic-gestures-pinchgesture.md)
- [RotationGesture](reference/arkui-ts/ts-basic-gestures-rotationgesture.md)
- [SwipeGesture](reference/arkui-ts/ts-basic-gestures-swipegesture.md)
- [Combined Gestures](reference/arkui-ts/ts-combined-gestures.md)
- Basic Components
- [AlphabetIndexer](reference/arkui-ts/ts-container-alphabet-indexer.md)
- [Blank](reference/arkui-ts/ts-basic-components-blank.md)
- [Button](reference/arkui-ts/ts-basic-components-button.md)
- [Checkbox](reference/arkui-ts/ts-basic-components-checkbox.md)
- [CheckboxGroup](reference/arkui-ts/ts-basic-components-checkboxgroup.md)
- [DataPanel](reference/arkui-ts/ts-basic-components-datapanel.md)
- [DatePicker](reference/arkui-ts/ts-basic-components-datepicker.md)
- [Divider](reference/arkui-ts/ts-basic-components-divider.md)
- [Formcomponent](reference/arkui-ts/ts-basic-components-formcomponent.md)
- [Gauge](reference/arkui-ts/ts-basic-components-gauge.md)
- [Image](reference/arkui-ts/ts-basic-components-image.md)
- [ImageAnimator](reference/arkui-ts/ts-basic-components-imageanimator.md)
- [LoadingProgress](reference/arkui-ts/ts-basic-components-loadingprogress.md)
- [Marquee](reference/arkui-ts/ts-basic-components-marquee.md)
- [Menu](reference/arkui-ts/ts-basic-components-menu.md)
- [MenuItem](reference/arkui-ts/ts-basic-components-menuitem.md)
- [MenuItemGroup](reference/arkui-ts/ts-basic-components-menuitemgroup.md)
- [Navigation](reference/arkui-ts/ts-basic-components-navigation.md)
- [NavRouter](reference/arkui-ts/ts-basic-components-navrouter.md)
- [NavDestination](reference/arkui-ts/ts-basic-components-navdestination.md)
- [PatternLock](reference/arkui-ts/ts-basic-components-patternlock.md)
- [PluginComponent](reference/arkui-ts/ts-basic-components-plugincomponent.md)
- [Progress](reference/arkui-ts/ts-basic-components-progress.md)
- [QRCode](reference/arkui-ts/ts-basic-components-qrcode.md)
- [Radio](reference/arkui-ts/ts-basic-components-radio.md)
- [Rating](reference/arkui-ts/ts-basic-components-rating.md)
- [RemoteWindow](reference/arkui-ts/ts-basic-components-remotewindow.md)
- [RichText](reference/arkui-ts/ts-basic-components-richtext.md)
- [ScrollBar](reference/arkui-ts/ts-basic-components-scrollbar.md)
- [Search](reference/arkui-ts/ts-basic-components-search.md)
- [Select](reference/arkui-ts/ts-basic-components-select.md)
- [Slider](reference/arkui-ts/ts-basic-components-slider.md)
- [Span](reference/arkui-ts/ts-basic-components-span.md)
- [Stepper](reference/arkui-ts/ts-basic-components-stepper.md)
- [StepperItem](reference/arkui-ts/ts-basic-components-stepperitem.md)
- [Text](reference/arkui-ts/ts-basic-components-text.md)
- [TextArea](reference/arkui-ts/ts-basic-components-textarea.md)
- [TextClock](reference/arkui-ts/ts-basic-components-textclock.md)
- [TextInput](reference/arkui-ts/ts-basic-components-textinput.md)
- [TextPicker](reference/arkui-ts/ts-basic-components-textpicker.md)
- [TextTimer](reference/arkui-ts/ts-basic-components-texttimer.md)
- [TimePicker](reference/arkui-ts/ts-basic-components-timepicker.md)
- [Toggle](reference/arkui-ts/ts-basic-components-toggle.md)
- [Web](reference/arkui-ts/ts-basic-components-web.md)
- [XComponent](reference/arkui-ts/ts-basic-components-xcomponent.md)
- Container Components
- [AbilityComponent](reference/arkui-ts/ts-container-ability-component.md)
- [Badge](reference/arkui-ts/ts-container-badge.md)
- [Column](reference/arkui-ts/ts-container-column.md)
- [ColumnSplit](reference/arkui-ts/ts-container-columnsplit.md)
- [Counter](reference/arkui-ts/ts-container-counter.md)
- [Flex](reference/arkui-ts/ts-container-flex.md)
- [GridCol](reference/arkui-ts/ts-container-gridcol.md)
- [GridRow](reference/arkui-ts/ts-container-gridrow.md)
- [Grid](reference/arkui-ts/ts-container-grid.md)
- [GridItem](reference/arkui-ts/ts-container-griditem.md)
- [List](reference/arkui-ts/ts-container-list.md)
- [ListItem](reference/arkui-ts/ts-container-listitem.md)
- [ListItemGroup](reference/arkui-ts/ts-container-listitemgroup.md)
- [Navigator](reference/arkui-ts/ts-container-navigator.md)
- [Panel](reference/arkui-ts/ts-container-panel.md)
- [Refresh](reference/arkui-ts/ts-container-refresh.md)
- [RelativeContainer](reference/arkui-ts/ts-container-relativecontainer.md)
- [Row](reference/arkui-ts/ts-container-row.md)
- [RowSplit](reference/arkui-ts/ts-container-rowsplit.md)
- [Scroll](reference/arkui-ts/ts-container-scroll.md)
- [SideBarContainer](reference/arkui-ts/ts-container-sidebarcontainer.md)
- [Stack](reference/arkui-ts/ts-container-stack.md)
- [Swiper](reference/arkui-ts/ts-container-swiper.md)
- [Tabs](reference/arkui-ts/ts-container-tabs.md)
- [TabContent](reference/arkui-ts/ts-container-tabcontent.md)
- [WaterFlow](reference/arkui-ts/ts-container-waterflow.md)
- Media Component
- [Video](reference/arkui-ts/ts-media-components-video.md)
- Drawing Components
- [Circle](reference/arkui-ts/ts-drawing-components-circle.md)
- [Ellipse](reference/arkui-ts/ts-drawing-components-ellipse.md)
- [Line](reference/arkui-ts/ts-drawing-components-line.md)
- [Polyline](reference/arkui-ts/ts-drawing-components-polyline.md)
- [Polygon](reference/arkui-ts/ts-drawing-components-polygon.md)
- [Path](reference/arkui-ts/ts-drawing-components-path.md)
- [Rect](reference/arkui-ts/ts-drawing-components-rect.md)
- [Shape](reference/arkui-ts/ts-drawing-components-shape.md)
- Canvas Components
- [Canvas](reference/arkui-ts/ts-components-canvas-canvas.md)
- [CanvasRenderingContext2D](reference/arkui-ts/ts-canvasrenderingcontext2d.md)
- [CanvasGradient](reference/arkui-ts/ts-components-canvas-canvasgradient.md)
- [ImageBitmap](reference/arkui-ts/ts-components-canvas-imagebitmap.md)
- [ImageData](reference/arkui-ts/ts-components-canvas-imagedata.md)
- [OffscreenCanvasRenderingConxt2D](reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md)
- [Path2D](reference/arkui-ts/ts-components-canvas-path2d.md)
- [Lottie](reference/arkui-ts/ts-components-canvas-lottie.md)
- Animation
- [AnimatorProperty](reference/arkui-ts/ts-animatorproperty.md)
- [Explicit Animation](reference/arkui-ts/ts-explicit-animation.md)
- Transition Animation
- [Page Transition](reference/arkui-ts/ts-page-transition-animation.md)
- [Component Transition](reference/arkui-ts/ts-transition-animation-component.md)
- [Transition of Shared Elements](reference/arkui-ts/ts-transition-animation-shared-elements.md)
- [Motion Path Animation](reference/arkui-ts/ts-motion-path-animation.md)
- Global UI Methods
- Pop-up Window
- [Alert Dialog Box](reference/arkui-ts/ts-methods-alert-dialog-box.md)
- [Action Sheet](reference/arkui-ts/ts-methods-action-sheet.md)
- [Custom Dialog Box](reference/arkui-ts/ts-methods-custom-dialog-box.md)
- [Date Picker Dialog Box](reference/arkui-ts/ts-methods-datepicker-dialog.md)
- [Time Picker Dialog Box](reference/arkui-ts/ts-methods-timepicker-dialog.md)
- [Text Picker Dialog Box](reference/arkui-ts/ts-methods-textpicker-dialog.md)
- [Menu](reference/arkui-ts/ts-methods-menu.md)
- [Custom Component Lifecycle](reference/arkui-ts/ts-custom-component-lifecycle.md)
- [State Management with Application-level Variables](reference/arkui-ts/ts-state-management.md)
- [Pixel Units](reference/arkui-ts/ts-pixel-units.md)
- [Built-in Enums](reference/arkui-ts/ts-appendix-enums.md)
- [Types](reference/arkui-ts/ts-types.md)
- Deprecated Components
- [GridContainer](reference/arkui-ts/ts-container-gridcontainer.md)
- Component Reference (JavaScript-compatible Web-like Development Paradigm)
- Universal Component Information
- [Universal Attributes](reference/arkui-js/js-components-common-attributes.md)
- [Universal Styles](reference/arkui-js/js-components-common-styles.md)
- [Universal Events](reference/arkui-js/js-components-common-events.md)
- [Universal Methods](reference/arkui-js/js-components-common-methods.md)
- [Animation Styles](reference/arkui-js/js-components-common-animation.md)
- [Gradient Styles](reference/arkui-js/js-components-common-gradient.md)
- [Transition Styles](reference/arkui-js/js-components-common-transition.md)
- [Media Query](reference/arkui-js/js-components-common-mediaquery.md)
- [Custom Font Styles](reference/arkui-js/js-components-common-customizing-font.md)
- [Atomic Layout](reference/arkui-js/js-components-common-atomic-layout.md)
- Container Component
- [badge](reference/arkui-js/js-components-container-badge.md)
- [dialog](reference/arkui-js/js-components-container-dialog.md)
- [div](reference/arkui-js/js-components-container-div.md)
- [form](reference/arkui-js/js-components-container-form.md)
- [list](reference/arkui-js/js-components-container-list.md)
- [list-item](reference/arkui-js/js-components-container-list-item.md)
- [list-item-group](reference/arkui-js/js-components-container-list-item-group.md)
- [panel](reference/arkui-js/js-components-container-panel.md)
- [popup](reference/arkui-js/js-components-container-popup.md)
- [refresh](reference/arkui-js/js-components-container-refresh.md)
- [stack](reference/arkui-js/js-components-container-stack.md)
- [stepper](reference/arkui-js/js-components-container-stepper.md)
- [stepper-item](reference/arkui-js/js-components-container-stepper-item.md)
- [swiper](reference/arkui-js/js-components-container-swiper.md)
- [tabs](reference/arkui-js/js-components-container-tabs.md)
- [tab-bar](reference/arkui-js/js-components-container-tab-bar.md)
- [tab-content](reference/arkui-js/js-components-container-tab-content.md)
- Basic Components
- [button](reference/arkui-js/js-components-basic-button.md)
- [chart](reference/arkui-js/js-components-basic-chart.md)
- [divider](reference/arkui-js/js-components-basic-divider.md)
- [image](reference/arkui-js/js-components-basic-image.md)
- [image-animator](reference/arkui-js/js-components-basic-image-animator.md)
- [input](reference/arkui-js/js-components-basic-input.md)
- [label](reference/arkui-js/js-components-basic-label.md)
- [marquee](reference/arkui-js/js-components-basic-marquee.md)
- [menu](reference/arkui-js/js-components-basic-menu.md)
- [option](reference/arkui-js/js-components-basic-option.md)
- [picker](reference/arkui-js/js-components-basic-picker.md)
- [picker-view](reference/arkui-js/js-components-basic-picker-view.md)
- [piece](reference/arkui-js/js-components-basic-piece.md)
- [progress](reference/arkui-js/js-components-basic-progress.md)
- [qrcode](reference/arkui-js/js-components-basic-qrcode.md)
- [rating](reference/arkui-js/js-components-basic-rating.md)
- [richtext](reference/arkui-js/js-components-basic-richtext.md)
- [search](reference/arkui-js/js-components-basic-search.md)
- [select](reference/arkui-js/js-components-basic-select.md)
- [slider](reference/arkui-js/js-components-basic-slider.md)
- [span](reference/arkui-js/js-components-basic-span.md)
- [switch](reference/arkui-js/js-components-basic-switch.md)
- [text](reference/arkui-js/js-components-basic-text.md)
- [textarea](reference/arkui-js/js-components-basic-textarea.md)
- [toolbar](reference/arkui-js/js-components-basic-toolbar.md)
- [toolbar-item](reference/arkui-js/js-components-basic-toolbar-item.md)
- [toggle](reference/arkui-js/js-components-basic-toggle.md)
- [web](reference/arkui-js/js-components-basic-web.md)
- [xcomponent](reference/arkui-js/js-components-basic-xcomponent.md)
- Media Components
- [video](reference/arkui-js/js-components-media-video.md)
- Canvas Components
- [canvas](reference/arkui-js/js-components-canvas-canvas.md)
- [CanvasRenderingContext2D](reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md)
- [Image](reference/arkui-js/js-components-canvas-image.md)
- [CanvasGradient](reference/arkui-js/js-components-canvas-canvasgradient.md)
- [ImageData](reference/arkui-js/js-components-canvas-imagedata.md)
- [Path2D](reference/arkui-js/js-components-canvas-path2d.md)
- [ImageBitmap](reference/arkui-js/js-components-canvas-imagebitmap.md)
- [OffscreenCanvas](reference/arkui-js/js-components-canvas-offscreencanvas.md)
- [OffscreenCanvasRenderingContext2D](reference/arkui-js/js-offscreencanvasrenderingcontext2d.md)
- Grid Components
- [Basic Concepts](reference/arkui-js/js-components-grid-basic-concepts.md)
- [grid-container](reference/arkui-js/js-components-grid-container.md)
- [grid-row](reference/arkui-js/js-components-grid-row.md)
- [grid-col](reference/arkui-js/js-components-grid-col.md)
- SVG Components
- [Universal Attributes](reference/arkui-js/js-components-svg-common-attributes.md)
- [svg](reference/arkui-js/js-components-svg.md)
- [rect](reference/arkui-js/js-components-svg-rect.md)
- [circle](reference/arkui-js/js-components-svg-circle.md)
- [ellipse](reference/arkui-js/js-components-svg-ellipse.md)
- [path](reference/arkui-js/js-components-svg-path.md)
- [line](reference/arkui-js/js-components-svg-line.md)
- [polyline](reference/arkui-js/js-components-svg-polyline.md)
- [polygon](reference/arkui-js/js-components-svg-polygon.md)
- [text](reference/arkui-js/js-components-svg-text.md)
- [tspan](reference/arkui-js/js-components-svg-tspan.md)
- [textPath](reference/arkui-js/js-components-svg-textpath.md)
- [animate](reference/arkui-js/js-components-svg-animate.md)
- [animateMotion](reference/arkui-js/js-components-svg-animatemotion.md)
- [animateTransform](reference/arkui-js/js-components-svg-animatetransform.md)
- Custom Components
- [Basic Usage](reference/arkui-js/js-components-custom-basic-usage.md)
- [props](reference/arkui-js/js-components-custom-props.md)
- [Style Inheritance](reference/arkui-js/js-components-custom-style.md)
- [slot](reference/arkui-js/js-components-custom-slot.md)
- [Lifecycle Definition](reference/arkui-js/js-components-custom-lifecycle.md)
- [Dynamic Component Creation](reference/arkui-js/js-components-create-elements.md)
- [Data Type Attributes](reference/arkui-js/js-appendix-types.md)
- JS Service Widget UI Components
- JS Service Widget UI Framework
- [File Organization](reference/js-service-widget-ui/js-service-widget-file.md)
- Syntax
- [HML](reference/js-service-widget-ui/js-service-widget-syntax-hml.md)
- [CSS](reference/js-service-widget-ui/js-service-widget-syntax-css.md)
- [Multi-Language Capability](reference/js-service-widget-ui/js-service-widget-multiple-languages.md)
- [Version Compatibility Adaptation](reference/js-service-widget-ui/js-service-widget-version-compatibility.md)
- [Theme Configuration](reference/js-service-widget-ui/js-service-widget-theme.md)
- Components
- Universal
- [Universal Attributes](reference/js-service-widget-ui/js-service-widget-common-attributes.md)
- [Universal Styles](reference/js-service-widget-ui/js-service-widget-common-styles.md)
- [Universal Events](reference/js-service-widget-ui/js-service-widget-common-events.md)
- [Gradient Styles](reference/js-service-widget-ui/js-service-widget-common-gradient.md)
- [Media Query](reference/js-service-widget-ui/js-service-widget-common-mediaquery.md)
- [Custom Font Styles](reference/js-service-widget-ui/js-service-widget-common-customizing-font.md)
- [Accessibility](reference/js-service-widget-ui/js-service-widget-common-accessibility.md)
- [Atomic Layout](reference/js-service-widget-ui/js-service-widget-common-atomic-layout.md)
- Container Components
- [badge](reference/js-service-widget-ui/js-service-widget-container-badge.md)
- [div](reference/js-service-widget-ui/js-service-widget-container-div.md)
- [list](reference/js-service-widget-ui/js-service-widget-container-list.md)
- [list-item](reference/js-service-widget-ui/js-service-widget-container-list-item.md)
- [stack](reference/js-service-widget-ui/js-service-widget-container-stack.md)
- [swiper](reference/js-service-widget-ui/js-service-widget-container-swiper.md)
- Basic Components
- [button](reference/js-service-widget-ui/js-service-widget-basic-button.md)
- [calendar](reference/js-service-widget-ui/js-service-widget-basic-calendar.md)
- [chart](reference/js-service-widget-ui/js-service-widget-basic-chart.md)
- [clock](reference/js-service-widget-ui/js-service-widget-basic-clock.md)
- [divider](reference/js-service-widget-ui/js-service-widget-basic-divider.md)
- [image](reference/js-service-widget-ui/js-service-widget-basic-image.md)
- [input](reference/js-service-widget-ui/js-service-widget-basic-input.md)
- [progress](reference/js-service-widget-ui/js-service-widget-basic-progress.md)
- [span](reference/js-service-widget-ui/js-service-widget-basic-span.md)
- [text](reference/js-service-widget-ui/js-service-widget-basic-text.md)
- [Custom Component Basic Usage](reference/js-service-widget-ui/js-service-widget-custom-basic-usage.md)
- [Data Types](reference/js-service-widget-ui/js-service-widget-appendix-types.md)
- JS and TS APIs
- [API Reference Document Description](reference/apis/development-intro.md) - [API Reference Document Description](reference/apis/development-intro.md)
- Ability Framework - Ability Framework
- Stage Model (Recommended) - Stage Model (Recommended)
...@@ -1087,6 +777,7 @@ ...@@ -1087,6 +777,7 @@
- UI Page - UI Page
- [@ohos.animator (Animator)](reference/apis/js-apis-animator.md) - [@ohos.animator (Animator)](reference/apis/js-apis-animator.md)
- [@ohos.curves (Interpolation Calculation)](reference/apis/js-apis-curve.md) - [@ohos.curves (Interpolation Calculation)](reference/apis/js-apis-curve.md)
- [@ohos.font (Custom Font Registration)](reference/apis/js-apis-font.md)
- [@ohos.matrix4 (Matrix Transformation)](reference/apis/js-apis-matrix4.md) - [@ohos.matrix4 (Matrix Transformation)](reference/apis/js-apis-matrix4.md)
- [@ohos.mediaquery (Media Query)](reference/apis/js-apis-mediaquery.md) - [@ohos.mediaquery (Media Query)](reference/apis/js-apis-mediaquery.md)
- [@ohos.pluginComponent (PluginComponentManager)](reference/apis/js-apis-plugincomponent.md) - [@ohos.pluginComponent (PluginComponentManager)](reference/apis/js-apis-plugincomponent.md)
...@@ -1111,7 +802,7 @@ ...@@ -1111,7 +802,7 @@
- [@ohos.multimedia.camera (Camera Management)](reference/apis/js-apis-camera.md) - [@ohos.multimedia.camera (Camera Management)](reference/apis/js-apis-camera.md)
- [@ohos.multimedia.image (Image Processing)](reference/apis/js-apis-image.md) - [@ohos.multimedia.image (Image Processing)](reference/apis/js-apis-image.md)
- [@ohos.multimedia.media (Media)](reference/apis/js-apis-media.md) - [@ohos.multimedia.media (Media)](reference/apis/js-apis-media.md)
- Resource Manager - Resource Management
- [@ohos.i18n (Internationalization)](reference/apis/js-apis-i18n.md) - [@ohos.i18n (Internationalization)](reference/apis/js-apis-i18n.md)
- [@ohos.intl (Internationalization)](reference/apis/js-apis-intl.md) - [@ohos.intl (Internationalization)](reference/apis/js-apis-intl.md)
- [@ohos.resourceManager (Resource Manager)](reference/apis/js-apis-resource-manager.md) - [@ohos.resourceManager (Resource Manager)](reference/apis/js-apis-resource-manager.md)
...@@ -1253,7 +944,7 @@ ...@@ -1253,7 +944,7 @@
- [@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](reference/apis/js-apis-EnterpriseAdminExtensionAbility.md) - [@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](reference/apis/js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterprise.adminManager (Enterprise Device Management)](reference/apis/js-apis-enterprise-adminManager.md) - [@ohos.enterprise.adminManager (Enterprise Device Management)](reference/apis/js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.dateTimeManager (System Time Management)](reference/apis/js-apis-enterprise-dateTimeManager.md) - [@ohos.enterprise.dateTimeManager (System Time Management)](reference/apis/js-apis-enterprise-dateTimeManager.md)
- Language Base Class Library - Common Library
- [@ohos.buffer (Buffer)](reference/apis/js-apis-buffer.md) - [@ohos.buffer (Buffer)](reference/apis/js-apis-buffer.md)
- [@ohos.convertxml (XML-to-JavaScript Conversion)](reference/apis/js-apis-convertxml.md) - [@ohos.convertxml (XML-to-JavaScript Conversion)](reference/apis/js-apis-convertxml.md)
- [@ohos.process (Obtaining Process Information)](reference/apis/js-apis-process.md) - [@ohos.process (Obtaining Process Information)](reference/apis/js-apis-process.md)
...@@ -1279,7 +970,7 @@ ...@@ -1279,7 +970,7 @@
- [@ohos.xml (XML Parsing and Generation)](reference/apis/js-apis-xml.md) - [@ohos.xml (XML Parsing and Generation)](reference/apis/js-apis-xml.md)
- Test - Test
- [@ohos.application.testRunner (TestRunner)](reference/apis/js-apis-application-testRunner.md) - [@ohos.application.testRunner (TestRunner)](reference/apis/js-apis-application-testRunner.md)
- [@ohos.uitest](reference/apis/js-apis-uitest.md) - [@ohos.uitest (UiTest)](reference/apis/js-apis-uitest.md)
- APIs No Longer Maintained - APIs No Longer Maintained
- [@ohos.backgroundTaskManager (Background Task Management)](reference/apis/js-apis-backgroundTaskManager.md) - [@ohos.backgroundTaskManager (Background Task Management)](reference/apis/js-apis-backgroundTaskManager.md)
- [@ohos.bluetooth (Bluetooth)](reference/apis/js-apis-bluetooth.md) - [@ohos.bluetooth (Bluetooth)](reference/apis/js-apis-bluetooth.md)
...@@ -1311,7 +1002,7 @@ ...@@ -1311,7 +1002,7 @@
- [@system.device (Device Information)](reference/apis/js-apis-system-device.md) - [@system.device (Device Information)](reference/apis/js-apis-system-device.md)
- [@system.fetch (Data Request)](reference/apis/js-apis-system-fetch.md) - [@system.fetch (Data Request)](reference/apis/js-apis-system-fetch.md)
- [@system.file (File Storage)](reference/apis/js-apis-system-file.md) - [@system.file (File Storage)](reference/apis/js-apis-system-file.md)
- [@system.geolocation (Geographic Location)](reference/apis/js-apis-system-location.md) - [@system.geolocation (Geolocation)](reference/apis/js-apis-system-location.md)
- [@system.mediaquery (Media Query)](reference/apis/js-apis-system-mediaquery.md) - [@system.mediaquery (Media Query)](reference/apis/js-apis-system-mediaquery.md)
- [@system.network (Network State)](reference/apis/js-apis-system-network.md) - [@system.network (Network State)](reference/apis/js-apis-system-network.md)
- [@system.notification (Notification)](reference/apis/js-apis-system-notification.md) - [@system.notification (Notification)](reference/apis/js-apis-system-notification.md)
...@@ -1338,6 +1029,349 @@ ...@@ -1338,6 +1029,349 @@
- [shortcutInfo](reference/apis/js-apis-bundle-ShortcutInfo.md) - [shortcutInfo](reference/apis/js-apis-bundle-ShortcutInfo.md)
- data/rdb - data/rdb
- [resultSet](reference/apis/js-apis-data-resultset.md) - [resultSet](reference/apis/js-apis-data-resultset.md)
- Component Reference (ArkTS-based Declarative Development Paradigm)
- [Component Overview](reference/arkui-ts/ts-components-summary.md)
- Universal Component Information
- Universal Events
- [Click Event](reference/arkui-ts/ts-universal-events-click.md)
- [Touch Event](reference/arkui-ts/ts-universal-events-touch.md)
- [Show/Hide Event](reference/arkui-ts/ts-universal-events-show-hide.md)
- [Drag/Drop Event](reference/arkui-ts/ts-universal-events-drag-drop.md)
- [Key Event](reference/arkui-ts/ts-universal-events-key.md)
- [Focus Event](reference/arkui-ts/ts-universal-focus-event.md)
- [Mouse Event](reference/arkui-ts/ts-universal-mouse-key.md)
- [Component Area Change Event](reference/arkui-ts/ts-universal-component-area-change-event.md)
- [Visible Area Change Event](reference/arkui-ts/ts-universal-component-visible-area-change-event.md)
- Universal Attributes
- [Size](reference/arkui-ts/ts-universal-attributes-size.md)
- [Location](reference/arkui-ts/ts-universal-attributes-location.md)
- [Layout Constraints](reference/arkui-ts/ts-universal-attributes-layout-constraints.md)
- [Flex Layout](reference/arkui-ts/ts-universal-attributes-flex-layout.md)
- [Border](reference/arkui-ts/ts-universal-attributes-border.md)
- [Border Image](reference/arkui-ts/ts-universal-attributes-border-image.md)
- [Background](reference/arkui-ts/ts-universal-attributes-background.md)
- [Opacity](reference/arkui-ts/ts-universal-attributes-opacity.md)
- [Visibility](reference/arkui-ts/ts-universal-attributes-visibility.md)
- [Enable/Disable](reference/arkui-ts/ts-universal-attributes-enable.md)
- [Overlay](reference/arkui-ts/ts-universal-attributes-overlay.md)
- [Z-order Control](reference/arkui-ts/ts-universal-attributes-z-order.md)
- [Transformation](reference/arkui-ts/ts-universal-attributes-transformation.md)
- [Image Effect Configuration](reference/arkui-ts/ts-universal-attributes-image-effect.md)
- [Shape Clipping](reference/arkui-ts/ts-universal-attributes-sharp-clipping.md)
- [Text Style](reference/arkui-ts/ts-universal-attributes-text-style.md)
- [Grid](reference/arkui-ts/ts-universal-attributes-grid.md)
- [Gradient Color](reference/arkui-ts/ts-universal-attributes-gradient-color.md)
- [Popup Control](reference/arkui-ts/ts-universal-attributes-popup.md)
- [Menu Control](reference/arkui-ts/ts-universal-attributes-menu.md)
- [Click Control](reference/arkui-ts/ts-universal-attributes-click.md)
- [Focus Control](reference/arkui-ts/ts-universal-attributes-focus.md)
- [Hover Effect](reference/arkui-ts/ts-universal-attributes-hover-effect.md)
- [Component ID](reference/arkui-ts/ts-universal-attributes-component-id.md)
- [Touch Target](reference/arkui-ts/ts-universal-attributes-touch-target.md)
- [Polymorphic Style](reference/arkui-ts/ts-universal-attributes-polymorphic-style.md)
- [Hit Test Control](reference/arkui-ts/ts-universal-attributes-hit-test-behavior.md)
- [Background Blur](reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md)
- [restoreId](reference/arkui-ts/ts-universal-attributes-restoreId.md)
- Gesture Processing
- [Gesture Binding Methods](reference/arkui-ts/ts-gesture-settings.md)
- Basic Gestures
- [TapGesture](reference/arkui-ts/ts-basic-gestures-tapgesture.md)
- [LongPressGesture](reference/arkui-ts/ts-basic-gestures-longpressgesture.md)
- [PanGesture](reference/arkui-ts/ts-basic-gestures-pangesture.md)
- [PinchGesture](reference/arkui-ts/ts-basic-gestures-pinchgesture.md)
- [RotationGesture](reference/arkui-ts/ts-basic-gestures-rotationgesture.md)
- [SwipeGesture](reference/arkui-ts/ts-basic-gestures-swipegesture.md)
- [Combined Gestures](reference/arkui-ts/ts-combined-gestures.md)
- Basic Components
- [AlphabetIndexer](reference/arkui-ts/ts-container-alphabet-indexer.md)
- [Blank](reference/arkui-ts/ts-basic-components-blank.md)
- [Button](reference/arkui-ts/ts-basic-components-button.md)
- [Checkbox](reference/arkui-ts/ts-basic-components-checkbox.md)
- [CheckboxGroup](reference/arkui-ts/ts-basic-components-checkboxgroup.md)
- [DataPanel](reference/arkui-ts/ts-basic-components-datapanel.md)
- [DatePicker](reference/arkui-ts/ts-basic-components-datepicker.md)
- [Divider](reference/arkui-ts/ts-basic-components-divider.md)
- [FormComponent](reference/arkui-ts/ts-basic-components-formcomponent.md)
- [Gauge](reference/arkui-ts/ts-basic-components-gauge.md)
- [Image](reference/arkui-ts/ts-basic-components-image.md)
- [ImageAnimator](reference/arkui-ts/ts-basic-components-imageanimator.md)
- [LoadingProgress](reference/arkui-ts/ts-basic-components-loadingprogress.md)
- [Marquee](reference/arkui-ts/ts-basic-components-marquee.md)
- [Menu](reference/arkui-ts/ts-basic-components-menu.md)
- [MenuItem](reference/arkui-ts/ts-basic-components-menuitem.md)
- [MenuItemGroup](reference/arkui-ts/ts-basic-components-menuitemgroup.md)
- [Navigation](reference/arkui-ts/ts-basic-components-navigation.md)
- [NavRouter](reference/arkui-ts/ts-basic-components-navrouter.md)
- [NavDestination](reference/arkui-ts/ts-basic-components-navdestination.md)
- [PatternLock](reference/arkui-ts/ts-basic-components-patternlock.md)
- [PluginComponent](reference/arkui-ts/ts-basic-components-plugincomponent.md)
- [Progress](reference/arkui-ts/ts-basic-components-progress.md)
- [QRCode](reference/arkui-ts/ts-basic-components-qrcode.md)
- [Radio](reference/arkui-ts/ts-basic-components-radio.md)
- [Rating](reference/arkui-ts/ts-basic-components-rating.md)
- [RemoteWindow](reference/arkui-ts/ts-basic-components-remotewindow.md)
- [RichText](reference/arkui-ts/ts-basic-components-richtext.md)
- [ScrollBar](reference/arkui-ts/ts-basic-components-scrollbar.md)
- [Search](reference/arkui-ts/ts-basic-components-search.md)
- [Select](reference/arkui-ts/ts-basic-components-select.md)
- [Slider](reference/arkui-ts/ts-basic-components-slider.md)
- [Span](reference/arkui-ts/ts-basic-components-span.md)
- [Stepper](reference/arkui-ts/ts-basic-components-stepper.md)
- [StepperItem](reference/arkui-ts/ts-basic-components-stepperitem.md)
- [Text](reference/arkui-ts/ts-basic-components-text.md)
- [TextArea](reference/arkui-ts/ts-basic-components-textarea.md)
- [TextClock](reference/arkui-ts/ts-basic-components-textclock.md)
- [TextInput](reference/arkui-ts/ts-basic-components-textinput.md)
- [TextPicker](reference/arkui-ts/ts-basic-components-textpicker.md)
- [TextTimer](reference/arkui-ts/ts-basic-components-texttimer.md)
- [TimePicker](reference/arkui-ts/ts-basic-components-timepicker.md)
- [Toggle](reference/arkui-ts/ts-basic-components-toggle.md)
- [Web](reference/arkui-ts/ts-basic-components-web.md)
- [XComponent](reference/arkui-ts/ts-basic-components-xcomponent.md)
- Container Components
- [AbilityComponent](reference/arkui-ts/ts-container-ability-component.md)
- [Badge](reference/arkui-ts/ts-container-badge.md)
- [Column](reference/arkui-ts/ts-container-column.md)
- [ColumnSplit](reference/arkui-ts/ts-container-columnsplit.md)
- [Counter](reference/arkui-ts/ts-container-counter.md)
- [Flex](reference/arkui-ts/ts-container-flex.md)
- [GridCol](reference/arkui-ts/ts-container-gridcol.md)
- [GridRow](reference/arkui-ts/ts-container-gridrow.md)
- [Grid](reference/arkui-ts/ts-container-grid.md)
- [GridItem](reference/arkui-ts/ts-container-griditem.md)
- [List](reference/arkui-ts/ts-container-list.md)
- [ListItem](reference/arkui-ts/ts-container-listitem.md)
- [ListItemGroup](reference/arkui-ts/ts-container-listitemgroup.md)
- [Navigator](reference/arkui-ts/ts-container-navigator.md)
- [Panel](reference/arkui-ts/ts-container-panel.md)
- [Refresh](reference/arkui-ts/ts-container-refresh.md)
- [RelativeContainer](reference/arkui-ts/ts-container-relativecontainer.md)
- [Row](reference/arkui-ts/ts-container-row.md)
- [RowSplit](reference/arkui-ts/ts-container-rowsplit.md)
- [Scroll](reference/arkui-ts/ts-container-scroll.md)
- [SideBarContainer](reference/arkui-ts/ts-container-sidebarcontainer.md)
- [Stack](reference/arkui-ts/ts-container-stack.md)
- [Swiper](reference/arkui-ts/ts-container-swiper.md)
- [Tabs](reference/arkui-ts/ts-container-tabs.md)
- [TabContent](reference/arkui-ts/ts-container-tabcontent.md)
- [WaterFlow](reference/arkui-ts/ts-container-waterflow.md)
- Media Components
- [Video](reference/arkui-ts/ts-media-components-video.md)
- Drawing Components
- [Circle](reference/arkui-ts/ts-drawing-components-circle.md)
- [Ellipse](reference/arkui-ts/ts-drawing-components-ellipse.md)
- [Line](reference/arkui-ts/ts-drawing-components-line.md)
- [Polyline](reference/arkui-ts/ts-drawing-components-polyline.md)
- [Polygon](reference/arkui-ts/ts-drawing-components-polygon.md)
- [Path](reference/arkui-ts/ts-drawing-components-path.md)
- [Rect](reference/arkui-ts/ts-drawing-components-rect.md)
- [Shape](reference/arkui-ts/ts-drawing-components-shape.md)
- Canvas Components
- [Canvas](reference/arkui-ts/ts-components-canvas-canvas.md)
- [CanvasRenderingContext2D](reference/arkui-ts/ts-canvasrenderingcontext2d.md)
- [CanvasGradient](reference/arkui-ts/ts-components-canvas-canvasgradient.md)
- [ImageBitmap](reference/arkui-ts/ts-components-canvas-imagebitmap.md)
- [ImageData](reference/arkui-ts/ts-components-canvas-imagedata.md)
- [OffscreenCanvasRenderingContext2D](reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md)
- [Path2D](reference/arkui-ts/ts-components-canvas-path2d.md)
- Animation
- [AnimatorProperty](reference/arkui-ts/ts-animatorproperty.md)
- [Explicit Animation](reference/arkui-ts/ts-explicit-animation.md)
- Transition Animation
- [Page Transition](reference/arkui-ts/ts-page-transition-animation.md)
- [Component Transition](reference/arkui-ts/ts-transition-animation-component.md)
- [Transition of Shared Elements](reference/arkui-ts/ts-transition-animation-shared-elements.md)
- [Motion Path Animation](reference/arkui-ts/ts-motion-path-animation.md)
- Global UI Methods
- Pop-up Window
- [Alert Dialog Box](reference/arkui-ts/ts-methods-alert-dialog-box.md)
- [Action Sheet](reference/arkui-ts/ts-methods-action-sheet.md)
- [Custom Dialog Box](reference/arkui-ts/ts-methods-custom-dialog-box.md)
- [Date Picker Dialog Box](reference/arkui-ts/ts-methods-datepicker-dialog.md)
- [Time Picker Dialog Box](reference/arkui-ts/ts-methods-timepicker-dialog.md)
- [Text Picker Dialog Box](reference/arkui-ts/ts-methods-textpicker-dialog.md)
- [Menu](reference/arkui-ts/ts-methods-menu.md)
- [Custom Component Lifecycle](reference/arkui-ts/ts-custom-component-lifecycle.md)
- [State Management with Application-level Variables](reference/arkui-ts/ts-state-management.md)
- [Pixel Units](reference/arkui-ts/ts-pixel-units.md)
- [Built-in Enums](reference/arkui-ts/ts-appendix-enums.md)
- [Types](reference/arkui-ts/ts-types.md)
- Components No Longer Maintained
- [GridContainer](reference/arkui-ts/ts-container-gridcontainer.md)
- Component Reference (JavaScript-compatible Web-like Development Paradigm - ArkUI.Full)
- Universal Component Information
- [Universal Attributes](reference/arkui-js/js-components-common-attributes.md)
- [Universal Styles](reference/arkui-js/js-components-common-styles.md)
- [Universal Events](reference/arkui-js/js-components-common-events.md)
- [Universal Methods](reference/arkui-js/js-components-common-methods.md)
- [Animation Styles](reference/arkui-js/js-components-common-animation.md)
- [Gradient Styles](reference/arkui-js/js-components-common-gradient.md)
- [Transition Styles](reference/arkui-js/js-components-common-transition.md)
- [Media Query](reference/arkui-js/js-components-common-mediaquery.md)
- [Custom Font Styles](reference/arkui-js/js-components-common-customizing-font.md)
- [Atomic Layout](reference/arkui-js/js-components-common-atomic-layout.md)
- Container Components
- [badge](reference/arkui-js/js-components-container-badge.md)
- [dialog](reference/arkui-js/js-components-container-dialog.md)
- [div](reference/arkui-js/js-components-container-div.md)
- [form](reference/arkui-js/js-components-container-form.md)
- [list](reference/arkui-js/js-components-container-list.md)
- [list-item](reference/arkui-js/js-components-container-list-item.md)
- [list-item-group](reference/arkui-js/js-components-container-list-item-group.md)
- [panel](reference/arkui-js/js-components-container-panel.md)
- [popup](reference/arkui-js/js-components-container-popup.md)
- [refresh](reference/arkui-js/js-components-container-refresh.md)
- [stack](reference/arkui-js/js-components-container-stack.md)
- [stepper](reference/arkui-js/js-components-container-stepper.md)
- [stepper-item](reference/arkui-js/js-components-container-stepper-item.md)
- [swiper](reference/arkui-js/js-components-container-swiper.md)
- [tabs](reference/arkui-js/js-components-container-tabs.md)
- [tab-bar](reference/arkui-js/js-components-container-tab-bar.md)
- [tab-content](reference/arkui-js/js-components-container-tab-content.md)
- Basic Components
- [button](reference/arkui-js/js-components-basic-button.md)
- [chart](reference/arkui-js/js-components-basic-chart.md)
- [divider](reference/arkui-js/js-components-basic-divider.md)
- [image](reference/arkui-js/js-components-basic-image.md)
- [image-animator](reference/arkui-js/js-components-basic-image-animator.md)
- [input](reference/arkui-js/js-components-basic-input.md)
- [label](reference/arkui-js/js-components-basic-label.md)
- [marquee](reference/arkui-js/js-components-basic-marquee.md)
- [menu](reference/arkui-js/js-components-basic-menu.md)
- [option](reference/arkui-js/js-components-basic-option.md)
- [picker](reference/arkui-js/js-components-basic-picker.md)
- [picker-view](reference/arkui-js/js-components-basic-picker-view.md)
- [piece](reference/arkui-js/js-components-basic-piece.md)
- [progress](reference/arkui-js/js-components-basic-progress.md)
- [qrcode](reference/arkui-js/js-components-basic-qrcode.md)
- [rating](reference/arkui-js/js-components-basic-rating.md)
- [richtext](reference/arkui-js/js-components-basic-richtext.md)
- [search](reference/arkui-js/js-components-basic-search.md)
- [select](reference/arkui-js/js-components-basic-select.md)
- [slider](reference/arkui-js/js-components-basic-slider.md)
- [span](reference/arkui-js/js-components-basic-span.md)
- [switch](reference/arkui-js/js-components-basic-switch.md)
- [text](reference/arkui-js/js-components-basic-text.md)
- [textarea](reference/arkui-js/js-components-basic-textarea.md)
- [toolbar](reference/arkui-js/js-components-basic-toolbar.md)
- [toolbar-item](reference/arkui-js/js-components-basic-toolbar-item.md)
- [toggle](reference/arkui-js/js-components-basic-toggle.md)
- [web](reference/arkui-js/js-components-basic-web.md)
- [xcomponent](reference/arkui-js/js-components-basic-xcomponent.md)
- Media Components
- [video](reference/arkui-js/js-components-media-video.md)
- Canvas Components
- [canvas](reference/arkui-js/js-components-canvas-canvas.md)
- [CanvasRenderingContext2D](reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md)
- [Image](reference/arkui-js/js-components-canvas-image.md)
- [CanvasGradient](reference/arkui-js/js-components-canvas-canvasgradient.md)
- [ImageData](reference/arkui-js/js-components-canvas-imagedata.md)
- [Path2D](reference/arkui-js/js-components-canvas-path2d.md)
- [ImageBitmap](reference/arkui-js/js-components-canvas-imagebitmap.md)
- [OffscreenCanvas](reference/arkui-js/js-components-canvas-offscreencanvas.md)
- [OffscreenCanvasRenderingContext2D](reference/arkui-js/js-offscreencanvasrenderingcontext2d.md)
- Grid Components
- [Basic Concepts](reference/arkui-js/js-components-grid-basic-concepts.md)
- [grid-container](reference/arkui-js/js-components-grid-container.md)
- [grid-row](reference/arkui-js/js-components-grid-row.md)
- [grid-col](reference/arkui-js/js-components-grid-col.md)
- SVG Components
- [Universal Attributes](reference/arkui-js/js-components-svg-common-attributes.md)
- [svg](reference/arkui-js/js-components-svg.md)
- [rect](reference/arkui-js/js-components-svg-rect.md)
- [circle](reference/arkui-js/js-components-svg-circle.md)
- [ellipse](reference/arkui-js/js-components-svg-ellipse.md)
- [path](reference/arkui-js/js-components-svg-path.md)
- [line](reference/arkui-js/js-components-svg-line.md)
- [polyline](reference/arkui-js/js-components-svg-polyline.md)
- [polygon](reference/arkui-js/js-components-svg-polygon.md)
- [text](reference/arkui-js/js-components-svg-text.md)
- [tspan](reference/arkui-js/js-components-svg-tspan.md)
- [textPath](reference/arkui-js/js-components-svg-textpath.md)
- [animate](reference/arkui-js/js-components-svg-animate.md)
- [animateMotion](reference/arkui-js/js-components-svg-animatemotion.md)
- [animateTransform](reference/arkui-js/js-components-svg-animatetransform.md)
- Custom Components
- [Basic Usage](reference/arkui-js/js-components-custom-basic-usage.md)
- [props](reference/arkui-js/js-components-custom-props.md)
- [Style Inheritance](reference/arkui-js/js-components-custom-style.md)
- [slot](reference/arkui-js/js-components-custom-slot.md)
- [Lifecycle Definition](reference/arkui-js/js-components-custom-lifecycle.md)
- [Dynamic Component Creation](reference/arkui-js/js-components-create-elements.md)
- [Data Type Attributes](reference/arkui-js/js-appendix-types.md)
- Component Reference (JavaScript-compatible Web-like Development Paradigm - ArkUI.Lite)
- Framework Overview
- [File Organization](reference/arkui-js-lite/js-framework-file.md)
- ["js" Tag](reference/arkui-js-lite/js-framework-js-tag.md)
- [app.js](reference/arkui-js-lite/js-framework-js-file.md)
- Syntax
- [HML](reference/arkui-js-lite/js-framework-syntax-hml.md)
- [CSS](reference/arkui-js-lite/js-framework-syntax-css.md)
- [JavaScript](reference/arkui-js-lite/js-framework-syntax-js.md)
- Universal Component Information
- [Universal Events](reference/arkui-js-lite/js-common-events.md)
- [Universal Attributes](reference/arkui-js-lite/js-common-attributes.md)
- [Universal Styles](reference/arkui-js-lite/js-common-styles.md)
- [Animation Styles](reference/arkui-js-lite/js-components-common-animation.md)
- Container Components
- [div](reference/arkui-js-lite/js-components-container-div.md)
- [list](reference/arkui-js-lite/js-components-container-list.md)
- [list-item](reference/arkui-js-lite/js-components-container-list-item.md)
- [stack](reference/arkui-js-lite/js-components-container-stack.md)
- [swiper](reference/arkui-js-lite/js-components-container-swiper.md)
- Basic Components
- [chart](reference/arkui-js-lite/js-components-basic-chart.md)
- [image](reference/arkui-js-lite/js-components-basic-image.md)
- [image-animator](reference/arkui-js-lite/js-components-basic-image-animator.md)
- [input](reference/arkui-js-lite/js-components-basic-input.md)
- [marquee](reference/arkui-js-lite/js-components-basic-marquee.md)
- [picker-view](reference/arkui-js-lite/js-components-basic-picker-view.md)
- [progress](reference/arkui-js-lite/js-components-basic-progress.md)
- [qrcode](reference/arkui-js-lite/js-components-basic-qrcode.md)
- [slider](reference/arkui-js-lite/js-components-basic-slider.md)
- [switch](reference/arkui-js-lite/js-components-basic-switch.md)
- [text](reference/arkui-js-lite/js-components-basic-text.md)
- Canvas Components
- [canvas](reference/arkui-js-lite/js-components-canvas-canvas.md)
- [CanvasRenderingContext2D](reference/arkui-js-lite/js-components-canvas-canvasrenderingcontext2d.md)
- JavaScript Service Widget UI Component Reference
- JavaScript Service Widget UI Framework
- [File Organization](reference/js-service-widget-ui/js-service-widget-file.md)
- Syntax
- [HML](reference/js-service-widget-ui/js-service-widget-syntax-hml.md)
- [CSS](reference/js-service-widget-ui/js-service-widget-syntax-css.md)
- [Multi-Language Capability](reference/js-service-widget-ui/js-service-widget-multiple-languages.md)
- [Version Compatibility Adaptation](reference/js-service-widget-ui/js-service-widget-version-compatibility.md)
- [Theme Configuration](reference/js-service-widget-ui/js-service-widget-theme.md)
- Universal Components
- [Universal Attributes](reference/js-service-widget-ui/js-service-widget-common-attributes.md)
- [Universal Styles](reference/js-service-widget-ui/js-service-widget-common-styles.md)
- [Universal Events](reference/js-service-widget-ui/js-service-widget-common-events.md)
- [Gradient Styles](reference/js-service-widget-ui/js-service-widget-common-gradient.md)
- [Media Query](reference/js-service-widget-ui/js-service-widget-common-mediaquery.md)
- [Custom Font Styles](reference/js-service-widget-ui/js-service-widget-common-customizing-font.md)
- [Accessibility](reference/js-service-widget-ui/js-service-widget-common-accessibility.md)
- [Atomic Layout](reference/js-service-widget-ui/js-service-widget-common-atomic-layout.md)
- Container Components
- [badge](reference/js-service-widget-ui/js-service-widget-container-badge.md)
- [div](reference/js-service-widget-ui/js-service-widget-container-div.md)
- [list](reference/js-service-widget-ui/js-service-widget-container-list.md)
- [list-item](reference/js-service-widget-ui/js-service-widget-container-list-item.md)
- [stack](reference/js-service-widget-ui/js-service-widget-container-stack.md)
- [swiper](reference/js-service-widget-ui/js-service-widget-container-swiper.md)
- Basic Components
- [button](reference/js-service-widget-ui/js-service-widget-basic-button.md)
- [calendar](reference/js-service-widget-ui/js-service-widget-basic-calendar.md)
- [chart](reference/js-service-widget-ui/js-service-widget-basic-chart.md)
- [clock](reference/js-service-widget-ui/js-service-widget-basic-clock.md)
- [divider](reference/js-service-widget-ui/js-service-widget-basic-divider.md)
- [image](reference/js-service-widget-ui/js-service-widget-basic-image.md)
- [input](reference/js-service-widget-ui/js-service-widget-basic-input.md)
- [progress](reference/js-service-widget-ui/js-service-widget-basic-progress.md)
- [span](reference/js-service-widget-ui/js-service-widget-basic-span.md)
- [text](reference/js-service-widget-ui/js-service-widget-basic-text.md)
- [Custom Component Basic Usage](reference/js-service-widget-ui/js-service-widget-custom-basic-usage.md)
- [Data Types](reference/js-service-widget-ui/js-service-widget-appendix-types.md)
- Error Codes - Error Codes
- [Universal Error Codes](reference/errorcodes/errorcode-universal.md) - [Universal Error Codes](reference/errorcodes/errorcode-universal.md)
- Ability Framework - Ability Framework
...@@ -1347,7 +1381,7 @@ ...@@ -1347,7 +1381,7 @@
- Bundle Management - Bundle Management
- [Bundle Error Codes](reference/errorcodes/errorcode-bundle.md) - [Bundle Error Codes](reference/errorcodes/errorcode-bundle.md)
- [zlib Error Codes](reference/errorcodes/errorcode-zlib.md) - [zlib Error Codes](reference/errorcodes/errorcode-zlib.md)
- Common Events and Notification - Common Event and Notification
- [Event Error Codes](reference/errorcodes/errorcode-CommonEventService.md) - [Event Error Codes](reference/errorcodes/errorcode-CommonEventService.md)
- [Notification Error Codes](reference/errorcodes/errorcode-notification.md) - [Notification Error Codes](reference/errorcodes/errorcode-notification.md)
- [DistributedNotificationService Error Codes](reference/errorcodes/errorcode-DistributedNotificationService.md) - [DistributedNotificationService Error Codes](reference/errorcodes/errorcode-DistributedNotificationService.md)
...@@ -1363,7 +1397,7 @@ ...@@ -1363,7 +1397,7 @@
- [Audio Error Codes](reference/errorcodes/errorcode-audio.md) - [Audio Error Codes](reference/errorcodes/errorcode-audio.md)
- [Media Error Codes](reference/errorcodes/errorcode-media.md) - [Media Error Codes](reference/errorcodes/errorcode-media.md)
- [AVSession Management Error Codes](reference/errorcodes/errorcode-avsession.md) - [AVSession Management Error Codes](reference/errorcodes/errorcode-avsession.md)
- Resource Manager - Resource Management
- [I18N Error Codes](reference/errorcodes/errorcode-i18n.md) - [I18N Error Codes](reference/errorcodes/errorcode-i18n.md)
- [Resource Manager Error Codes](reference/errorcodes/errorcode-resource-manager.md) - [Resource Manager Error Codes](reference/errorcodes/errorcode-resource-manager.md)
- Background Task - Background Task
...@@ -1426,8 +1460,8 @@ ...@@ -1426,8 +1460,8 @@
- [Update Error Codes](reference/errorcodes/errorcode-update.md) - [Update Error Codes](reference/errorcodes/errorcode-update.md)
- Customization - Customization
- [Enterprise Device Management Error Codes](reference/errorcodes/errorcode-enterpriseDeviceManager.md) - [Enterprise Device Management Error Codes](reference/errorcodes/errorcode-enterpriseDeviceManager.md)
- Language Base Class Library - Common Library
- [Utils Error Codes](reference/errorcodes/errorcode-utils.md) - [Common Library Error Codes](reference/errorcodes/errorcode-utils.md)
- Test - Test
- [UiTest Error Codes](reference/errorcodes/errorcode-uitest.md) - [UiTest Error Codes](reference/errorcodes/errorcode-uitest.md)
- Native APIs - Native APIs
...@@ -1435,7 +1469,10 @@ ...@@ -1435,7 +1469,10 @@
- [Native XComponent](reference/native-apis/_o_h___native_x_component.md) - [Native XComponent](reference/native-apis/_o_h___native_x_component.md)
- [HiLog](reference/native-apis/_hi_log.md) - [HiLog](reference/native-apis/_hi_log.md)
- [NativeWindow](reference/native-apis/_native_window.md) - [NativeWindow](reference/native-apis/_native_window.md)
- [OH_NativeBuffer](reference/native-apis/_o_h___native_buffer.md)
- [Drawing](reference/native-apis/_drawing.md) - [Drawing](reference/native-apis/_drawing.md)
- [OH_NativeImage](reference/native-apis/_o_h___native_image.md)
- [NativeVsync](reference/native-apis/_native_vsync.md)
- [Image](reference/native-apis/image.md) - [Image](reference/native-apis/image.md)
- [Rawfile](reference/native-apis/rawfile.md) - [Rawfile](reference/native-apis/rawfile.md)
- [MindSpore](reference/native-apis/_mind_spore.md) - [MindSpore](reference/native-apis/_mind_spore.md)
...@@ -1463,7 +1500,10 @@ ...@@ -1463,7 +1500,10 @@
- [external_window.h](reference/native-apis/external__window_8h.md) - [external_window.h](reference/native-apis/external__window_8h.md)
- [image_pixel_map_napi.h](reference/native-apis/image__pixel__map__napi_8h.md) - [image_pixel_map_napi.h](reference/native-apis/image__pixel__map__napi_8h.md)
- [log.h](reference/native-apis/log_8h.md) - [log.h](reference/native-apis/log_8h.md)
- [native_buffer.h](reference/native-apis/native__buffer_8h.md)
- [native_image.h](reference/native-apis/native__image_8h.md)
- [native_interface_xcomponent.h](reference/native-apis/native__interface__xcomponent_8h.md) - [native_interface_xcomponent.h](reference/native-apis/native__interface__xcomponent_8h.md)
- [native_vsync.h](reference/native-apis/native__vsync_8h.md)
- [raw_dir.h](reference/native-apis/raw__dir_8h.md) - [raw_dir.h](reference/native-apis/raw__dir_8h.md)
- [raw_file_manager.h](reference/native-apis/raw__file__manager_8h.md) - [raw_file_manager.h](reference/native-apis/raw__file__manager_8h.md)
- [raw_file.h](reference/native-apis/raw__file_8h.md) - [raw_file.h](reference/native-apis/raw__file_8h.md)
...@@ -1489,6 +1529,7 @@ ...@@ -1489,6 +1529,7 @@
- [native_huks_type.h](reference/native-apis/native__huks__type_8h.md) - [native_huks_type.h](reference/native-apis/native__huks__type_8h.md)
- Structs - Structs
- [OH_Drawing_BitmapFormat](reference/native-apis/_o_h___drawing___bitmap_format.md) - [OH_Drawing_BitmapFormat](reference/native-apis/_o_h___drawing___bitmap_format.md)
- [OH_NativeBuffer_Config](reference/native-apis/_o_h___native_buffer___config.md)
- [OH_NativeXComponent_Callback](reference/native-apis/_o_h___native_x_component___callback.md) - [OH_NativeXComponent_Callback](reference/native-apis/_o_h___native_x_component___callback.md)
- [OH_NativeXComponent_MouseEvent](reference/native-apis/_o_h___native_x_component___mouse_event.md) - [OH_NativeXComponent_MouseEvent](reference/native-apis/_o_h___native_x_component___mouse_event.md)
- [OH_NativeXComponent_MouseEvent_Callback](reference/native-apis/_o_h___native_x_component___mouse_event___callback.md) - [OH_NativeXComponent_MouseEvent_Callback](reference/native-apis/_o_h___native_x_component___mouse_event___callback.md)
...@@ -1496,7 +1537,6 @@ ...@@ -1496,7 +1537,6 @@
- [OH_NativeXComponent_TouchPoint](reference/native-apis/_o_h___native_x_component___touch_point.md) - [OH_NativeXComponent_TouchPoint](reference/native-apis/_o_h___native_x_component___touch_point.md)
- [OHExtDataHandle](reference/native-apis/_o_h_ext_data_handle.md) - [OHExtDataHandle](reference/native-apis/_o_h_ext_data_handle.md)
- [OHHDRMetaData](reference/native-apis/_o_h_h_d_r_meta_data.md) - [OHHDRMetaData](reference/native-apis/_o_h_h_d_r_meta_data.md)
- [OhosPixelMapCreateOps](reference/native-apis/_ohos_pixel_map_create_ops.md)
- [OhosPixelMapInfo](reference/native-apis/_ohos_pixel_map_info.md) - [OhosPixelMapInfo](reference/native-apis/_ohos_pixel_map_info.md)
- [RawFileDescriptor](reference/native-apis/_raw_file_descriptor.md) - [RawFileDescriptor](reference/native-apis/_raw_file_descriptor.md)
- [Region](reference/native-apis/_region.md) - [Region](reference/native-apis/_region.md)
...@@ -1522,7 +1562,7 @@ ...@@ -1522,7 +1562,7 @@
- [OH_Huks_ParamSet](reference/native-apis/_o_h___huks___param_set.md) - [OH_Huks_ParamSet](reference/native-apis/_o_h___huks___param_set.md)
- [OH_Huks_PubKeyInfo](reference/native-apis/_o_h___huks___pub_key_info.md) - [OH_Huks_PubKeyInfo](reference/native-apis/_o_h___huks___pub_key_info.md)
- [OH_Huks_Result](reference/native-apis/_o_h___huks___result.md) - [OH_Huks_Result](reference/native-apis/_o_h___huks___result.md)
- Standard Libraries Supported by Native APIs - Standard Libraries
- [Node_API](reference/native-lib/third_party_napi/napi.md) - [Node_API](reference/native-lib/third_party_napi/napi.md)
- [libuv](reference/native-lib/third_party_libuv/libuv.md) - [libuv](reference/native-lib/third_party_libuv/libuv.md)
- [Native Standard Libraries Supported by Openharmony](reference/native-lib/third_party_libc/musl.md) - [Native Standard Libraries Supported by Openharmony](reference/native-lib/third_party_libc/musl.md)
......
# Smartperf-Host
## Overview
Smartperf-Host is an intuitive performance and power optimization tool that offers in-depth data mining and fine-grained data visualization. In this tool, you can gain visibility into a multitude of metrics in terms of CPU scheduling, frequency, process and thread time slices, heap memory, frame rate, and more, in swimlanes. Better yet, you can analyze the collected data intuitively on the GUI.
## Architecture
![System Architecture](figures/smartperf_frame.png)
Smartperf-Host consists of the device end and PC end, which exchange data with each other based on gRPC – a high-performance remote procedure call (RPC) framework.
The device end consists of modules such as Native Hook (application-embedded component), hiprofiler_command (command-line tool), hiprofilerd (performance profiler service), a set of performance profiler plug-ins, and some system tools and kernels. The device end provides the plug-in extension capability by exposing plug-in interfaces for external systems. By drawing on this capability, you can integrate custom plug-ins into the framework. For details about the preset plug-ins, see [Performance Profiler Component](https://gitee.com/openharmony/developtools_profiler).
The PC end is accessible from the Smartperf-Host website. It consists of modules such as Trace Streamer, SQLite, HDC device management, data import, UI drawing, and data analysis.
## Project Directory
```
/smartperf_host
├── host # Smartperf-Host related code
│ ├── doc # Smartperf-Host documentation
│ ├── ide # Smartperf-Host IDE module
│ │ └── src # Profiler module
│ │ │ ├── base-ui # Basic components
│ │ │ └── Trace # Service logic
│ ├── trace_streamer # Trace Streamer module
│ │ ├── base # Basic functionality
│ │ ├── cfg # Configuration
│ │ ├── filter # Filter
│ │ ├── include # Header files
│ │ ├── multi_platform # Platform adaptation
│ │ ├── parser # Parsing service logic
│ │ │ ├── bytrace_parser # byTrace service logic
│ │ │ └── htrace_parser # hTrace service logic
│ │ ├── table # Table structure
│ │ ├── trace_data # Trace structure
│ │ ├── trace_streamer # Trace Streamer structure
│ │ │ └── kits # JS APIs and native APIs
```
## Function Description
- Loading Trace Files on Web Pages
Load local trace files (such as htrace and ftrace) and display the data in swimlanes. For details, see [Loading Trace Files on Web Pages](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_systemtrace.md).
- Capturing Traces Online
Use Smartperf_Host to capture traces online, with the content, duration, and save path all customizable. For details, see [Capturing Traces on Web Pages](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_web_record.md).
- Capturing Traces on a Device
Capture traces on the target device, with the content, duration, and save path all customizable. For details, see [Capturing Traces from a Device](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_device_record.md).
- Using Ability Monitor
With Ability Monitor in Smartperf_Host, you can learn the CPU, memory, disk I/O, and network usage of your application. For details, see [Ability Monitor Usage](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_ability_monitor.md).
- Using Native Memory
With Native Memory in Smartperf_Host, you can track the allocation and release of your application's native memory (specific to C and C++). For details, see [Native Memory Usage](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_native_memory.md).
- Using Hiperf
With Hiperf in Smartperf_Host, you can view the CPU usage of your application and the call stack. For details, see [Hiperf Usage](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_hiperf.md).
- Using HiSystemEvent
With HiSystemEvent in Smartperf_Host, you can inspect the power consumption of each category (CPU, network, and location, and more) of your application, resource application and usage records (WorkScheduler, Runninglock, Alarm, and Location Request), power consumption exceptions, and system states associated with the power consumption (battery level and screen status). For details, see [HiSystemEvent Usage](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_hisystemevent.md).
- Collecting FileSystem Records
In Smartperf_Host, you can find out the system invoking information and read/write invoking times of all file systems. For details, see [Usage of FileSystem Recording](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_filesystem.md).
- Collecting Page Fault Records
In Smartperf_Host, you can collect page fault records, covering various aspects such as start time, duration, triggering process, triggering thread, event type, memory address, and memory size of page memory events. For details, see [Usage of Page Fault Recording](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_page_fault.md).
- Collecting BIO Records
In Smartperf_Host, you can collect I/O operation records, which provide the following information: start time, total latency, process, average latency of every 4 KB data, thread, operation (write data, page swap-in, and metadata), access traffic, path, block number, priority, and backtrace call stack. For details, see [Usage of BIO Latency Recording](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_bio.md).
- Collecting Smaps Records
In Smartperf_Host, you can collect the smaps data (type, Pss, Rss, Vss, and more) on a process-by-process basis. The data source is **/proc/$pid/smaps**. For details, see [Smaps Usage](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_smaps.md).
- Using SQL Analysis and Metrics
You can use Query (SQL) and Metrics features to quickly locate the trace data. For details, see [SQL Analysis and Metrics Usage](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/src/doc/md/quickstart_sql_metrics.md).
## Compilation Guidance
Project compilation includes Trace Streamer compilation and Smartperf-Host compilation and deployment.
### Prerequisites
- C++ version: 11 or later
- Node.js version: 16.15.1 or later
- npm version: 8.13.2 or later
- TypeScript version: 4.2.3 or later
- Go version: 1.13.8 or later
### Compiling Trace Streamer
To set up the Smartperf_Host website, you need to compile the WASM version of Trace Streamer for the web page to parse the original trace data. For details about the compilation process, see [Compiling Trace Streamer](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/trace_streamer/doc/compile_trace_streamer.md).
### Compiling and Deploying Smartperf-Host
For details about the compilation and deployment process, see [SmartPerf Compilation and Deployment Guide](https://gitee.com/openharmony-sig/developtools_smartperf_host/blob/master/ide/README_zh.md)). After successful deployment, you can start to use Smartperf_Host by visiting **https://[*IP address of the device where SmartPerf is deployed*]:9000/application/**.
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
基于OpenHarmony的应用模型,可以通过以下几种方式来实现UIAbility组件与UI之间的数据同步。 基于OpenHarmony的应用模型,可以通过以下几种方式来实现UIAbility组件与UI之间的数据同步。
- [使用EventHub进行数据通信](#使用eventhub进行数据通信):在基类Context中提供了EventHub对象,可以通过发布订阅方式来实现事件的传递。在事件传递前,订阅者需要先进行订阅,当发布者发布事件时,订阅者将接收到事件并进行相应处理。 - [使用EventHub进行数据通信](#使用eventhub进行数据通信):在基类Context中提供了EventHub对象,可以通过发布订阅方式来实现事件的传递。在事件传递前,订阅者需要先进行订阅,当发布者发布事件时,订阅者将接收到事件并进行相应处理。
- [使用globalThis进行数据同步](#使用globalthis进行数据同步):在ArkTS引擎实例内部,globalThis是一个全局对象,可以被UIAbility、ExtensionAbility、Page等组件访问。 - [使用globalThis进行数据同步](#使用globalthis进行数据同步):在ArkTS引擎实例内部,globalThis是一个全局对象,可以被ArkTS引擎实例内的UIAbility组件、ExtensionAbility组件和ArkUI页面(Page)访问。
- [使用AppStorage/LocalStorage进行数据同步](#使用appstorage/localstorage进行数据同步):ArkUI提供了AppStorage和LocalStorage两种应用级别的状态管理方案,可用于实现应用级别和UIAbility级别的数据同步。 - [使用AppStorage/LocalStorage进行数据同步](#使用appstorage/localstorage进行数据同步):ArkUI提供了AppStorage和LocalStorage两种应用级别的状态管理方案,可用于实现应用级别和UIAbility级别的数据同步。
## 使用EventHub进行数据通信 ## 使用EventHub进行数据通信
[EventHub](../reference/apis/js-apis-inner-application-eventHub.md)为UIAbility组件/ExtensionAbility组件提供了事件机制,使它们能够进行订阅、取消订阅和触发事件等数据通信能力。 [EventHub](../reference/apis/js-apis-inner-application-eventHub.md)为UIAbility组件提供了事件机制,使它们能够进行订阅、取消订阅和触发事件等数据通信能力。
[基类Context](application-context-stage.md)中,提供了EventHub对象,使用EventHub实现UIAbility与UI之间的数据通信需要先获取EventHub对象。本章节将以此为例进行说明。 [基类Context](application-context-stage.md)中,提供了EventHub对象,可用于在UIAbility组件实例内通信。使用EventHub实现UIAbility与UI之间的数据通信需要先获取EventHub对象,本章节将以此为例进行说明。
1. 在UIAbility中调用[`eventHub.on()`](../reference/apis/js-apis-inner-application-eventHub.md#eventhubon)方法注册一个自定义事件“event1”,[`eventHub.on()`](../reference/apis/js-apis-inner-application-eventHub.md#eventhubon)有如下两种调用方式,使用其中一种即可。 1. 在UIAbility中调用[`eventHub.on()`](../reference/apis/js-apis-inner-application-eventHub.md#eventhubon)方法注册一个自定义事件“event1”,[`eventHub.on()`](../reference/apis/js-apis-inner-application-eventHub.md#eventhubon)有如下两种调用方式,使用其中一种即可。
...@@ -211,6 +211,8 @@ globalThis是[ArkTS引擎实例](thread-model-stage.md)内部的一个全局对 ...@@ -211,6 +211,8 @@ globalThis是[ArkTS引擎实例](thread-model-stage.md)内部的一个全局对
- Stage模型下进程内的UIAbility组件共享ArkTS引擎实例,使用globalThis时需要避免存放相同名称的对象。例如UIAbilityA和UIAbilityB可以使用globalThis共享数据,在存放相同名称的对象时,先存放的对象会被后存放的对象覆盖。 - Stage模型下进程内的UIAbility组件共享ArkTS引擎实例,使用globalThis时需要避免存放相同名称的对象。例如UIAbilityA和UIAbilityB可以使用globalThis共享数据,在存放相同名称的对象时,先存放的对象会被后存放的对象覆盖。
- globalThis不支持跨进程使用,不同进程的UIAbility组件和ExtensionAbility组件无法使用globalThis共享数据,进程模型及进程间通信机制见[进程模型概述](./process-model-stage.md#进程模型概述)
- FA模型因为每个UIAbility组件之间引擎隔离,不会存在该问题。 - FA模型因为每个UIAbility组件之间引擎隔离,不会存在该问题。
- 对于绑定在globalThis上的对象,其生命周期与ArkTS虚拟机实例相同,建议在使用完成之后将其赋值为null,以减少对应用内存的占用。 - 对于绑定在globalThis上的对象,其生命周期与ArkTS虚拟机实例相同,建议在使用完成之后将其赋值为null,以减少对应用内存的占用。
......
...@@ -31,8 +31,7 @@ ...@@ -31,8 +31,7 @@
**字体像素单位:fp** **字体像素单位:fp**
字体像素(font pixel) 大小默认情况下与 vp 相同,即默认情况下 1 fp = 1vp。如果用户在设置中选择了更大的字体,字体的实际显示大小就会在 vp 的基础上乘以 scale 系数,即 1 fp = 1 vp \* scale。 字体像素(font pixel) 大小默认情况下与 vp 相同,即默认情况下 1 fp = 1vp。
**视觉属性:分层参数** **视觉属性:分层参数**
......
...@@ -198,9 +198,3 @@ Native Drawing模块提供了一系列的接口用于基本图形和字体的绘 ...@@ -198,9 +198,3 @@ Native Drawing模块提供了一系列的接口用于基本图形和字体的绘
// 将文本绘制到画布上 // 将文本绘制到画布上
OH_Drawing_TypographyPaint(typography, cCanvas, position[0], position[1]); OH_Drawing_TypographyPaint(typography, cCanvas, position[0], position[1]);
``` ```
## 相关实例
针对Drawing模块的使用,有以下相关实例可供参考:
* [Drawing模块2D图形绘制](https://gitee.com/openharmony/graphic_graphic_2d/blob/master/rosen/samples/2d_graphics/drawing_c_sample.cpp)
* [Drawing模块文本绘制](https://gitee.com/openharmony/graphic_graphic_2d/blob/master/rosen/samples/text/renderservice/drawing_text_c_sample.cpp)
...@@ -150,9 +150,3 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生 ...@@ -150,9 +150,3 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生
// 通过OH_NativeWindow_NativeWindowFlushBuffer 提交给消费者使用,例如:显示在屏幕上。 // 通过OH_NativeWindow_NativeWindowFlushBuffer 提交给消费者使用,例如:显示在屏幕上。
OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow_, buffer, fenceFd, region); OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow_, buffer, fenceFd, region);
``` ```
## 相关实例
针对NativeWindow的使用,有以下相关实例可供参考:
- [使用NativeWindow接口获取并提交Buffer](https://gitee.com/openharmony/graphic_graphic_2d/blob/master/rosen/samples/hello_native_window/hello_native_window.cpp)
...@@ -45,7 +45,7 @@ app.json5配置文件包含以下标签。 ...@@ -45,7 +45,7 @@ app.json5配置文件包含以下标签。
| minAPIVersion | 标识应用运行需要的SDK的API最小版本。 | 数值 | 由build-profile.json5中的compatibleSdkVersion生成。 | | minAPIVersion | 标识应用运行需要的SDK的API最小版本。 | 数值 | 由build-profile.json5中的compatibleSdkVersion生成。 |
| targetAPIVersion | 标识应用运行需要的API目标版本。 | 数值 | 由build-profile.json5中的compileSdkVersion生成。 | | targetAPIVersion | 标识应用运行需要的API目标版本。 | 数值 | 由build-profile.json5中的compileSdkVersion生成。 |
| apiReleaseType | 标识应用运行需要的API目标版本的类型,采用字符串类型表示。取值为“CanaryN”、“BetaN”或者“Release”,其中,N代表大于零的整数。<br/>-&nbsp;Canary:受限发布的版本。<br/>-&nbsp;Beta:公开发布的Beta版本。<br/>-&nbsp;Release:公开发布的正式版本。<br/>该字段由DevEco&nbsp;Studio读取当前使用的SDK的Stage来生成。 | 字符串 | 该标签可缺省,由IDE生成并覆盖。 | | apiReleaseType | 标识应用运行需要的API目标版本的类型,采用字符串类型表示。取值为“CanaryN”、“BetaN”或者“Release”,其中,N代表大于零的整数。<br/>-&nbsp;Canary:受限发布的版本。<br/>-&nbsp;Beta:公开发布的Beta版本。<br/>-&nbsp;Release:公开发布的正式版本。<br/>该字段由DevEco&nbsp;Studio读取当前使用的SDK的Stage来生成。 | 字符串 | 该标签可缺省,由IDE生成并覆盖。 |
| multiProjects | 标识当前工程是否支持多个工程的联合开发。<br/>-&nbsp;true:当前工程支持多个工程的联合开发。<br/>-&nbsp;false:当前工程不支持多个工程的联合开发。多工程开发可以参考文档:[多工程构建](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-building-overview-0000001263360495-V3#section71471033104216) | 布尔值 | 可缺省,缺省值为false。 | | multiProjects | 标识当前工程是否支持多个工程的联合开发。<br/>-&nbsp;true:当前工程支持多个工程的联合开发。<br/>-&nbsp;false:当前工程不支持多个工程的联合开发。多工程开发可以参考文档:[多工程构建](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/build_overview-0000001055075201-V3#section73401914284) | 布尔值 | 可缺省,缺省值为false。 |
| tablet | 标识对tablet设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。<br/>如果使用该属性对tablet设备做了特殊配置,则应用在tablet设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tablet设备使用app.json5公共区域配置的属性值。 | | tablet | 标识对tablet设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。<br/>如果使用该属性对tablet设备做了特殊配置,则应用在tablet设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tablet设备使用app.json5公共区域配置的属性值。 |
| tv | 标识对tv设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。<br/>如果使用该属性对tv设备做了特殊配置,则应用在tv设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tv设备使用app.json5公共区域配置的属性值。 | | tv | 标识对tv设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。<br/>如果使用该属性对tv设备做了特殊配置,则应用在tv设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tv设备使用app.json5公共区域配置的属性值。 |
| wearable | 标识对wearable设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。<br/>如果使用该属性对wearable设备做了特殊配置,则应用在wearable设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时wearable设备使用app.json5公共区域配置的属性值。 | | wearable | 标识对wearable设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。<br/>如果使用该属性对wearable设备做了特殊配置,则应用在wearable设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时wearable设备使用app.json5公共区域配置的属性值。 |
......
...@@ -26,7 +26,7 @@ LocalStorage是ArkTS为构建页面级别状态变量提供存储的内存内“ ...@@ -26,7 +26,7 @@ LocalStorage是ArkTS为构建页面级别状态变量提供存储的内存内“
应用程序决定LocalStorage对象的生命周期。当应用释放最后一个指向LocalStorage的引用时,比如销毁最后一个自定义组件,LocalStorage将被JS Engine垃圾回收。 应用程序决定LocalStorage对象的生命周期。当应用释放最后一个指向LocalStorage的引用时,比如销毁最后一个自定义组件,LocalStorage将被JS Engine垃圾回收。
LocalStorage根据与\@Component装饰的组件的同步类型不同,提供了两个装饰器: LocalStorage根据与\@Component装饰的组件的同步类型不同,提供了两个装饰器:
- [@LocalStorageProp](#localstorageprop)\@LocalStorageProp装饰的变量和与LocalStorage中给定属性建立单行同步关系。 - [@LocalStorageProp](#localstorageprop)\@LocalStorageProp装饰的变量和与LocalStorage中给定属性建立单行同步关系。
...@@ -306,7 +306,7 @@ struct CompA { ...@@ -306,7 +306,7 @@ struct CompA {
先看Parent自定义组件中发生的变化: 先看Parent自定义组件中发生的变化:
1. 点击“countStorage ${this.playCount} incr by 1”,this.playCount减1,修改同步回LocalStorage中,Child组件中的playCountLink绑定的组件会同步刷新; 1. 点击“playCount ${this.playCount} dec by 1”,this.playCount减1,修改同步回LocalStorage中,Child组件中的playCountLink绑定的组件会同步刷新;
2. 点击“countStorage ${this.playCount} incr by 1”,调用LocalStorage的set接口,更新LocalStorage中“countStorage”对应的属性,Child组件中的playCountLink绑定的组件会同步刷新; 2. 点击“countStorage ${this.playCount} incr by 1”,调用LocalStorage的set接口,更新LocalStorage中“countStorage”对应的属性,Child组件中的playCountLink绑定的组件会同步刷新;
......
...@@ -131,7 +131,7 @@ struct BasketModifier { ...@@ -131,7 +131,7 @@ struct BasketModifier {
### \@Watch和自定义组件更新 ### \@Watch和自定义组件更新
以下示例展示组件更新和\@Watch的处理步骤。count在两个组件中均由\@State装饰。 以下示例展示组件更新和\@Watch的处理步骤。count在CountModifier中由\@State装饰,在TotalView中由\@Prop装饰。
```ts ```ts
......
...@@ -645,7 +645,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -645,7 +645,7 @@ SystemCapability.BundleManager.BundleFramework
```ts ```ts
let bundleName = "com.example.myapplication"; let bundleName = "com.example.myapplication";
bundleManager.setApplicationEnabled(bundleName, false).then(()=> { bundle.setApplicationEnabled(bundleName, false).then(()=> {
console.info('setApplicationEnabled successfully.'); console.info('setApplicationEnabled successfully.');
}).catch(err=> { }).catch(err=> {
console.error('setApplicationEnabled failed.'); console.error('setApplicationEnabled failed.');
...@@ -766,7 +766,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -766,7 +766,7 @@ SystemCapability.BundleManager.BundleFramework
```ts ```ts
let permission = "ohos.permission.GET_BUNDLE_INFO"; let permission = "ohos.permission.GET_BUNDLE_INFO";
bundleManager.getPermissionDef(permission, (err, data) => { bundle.getPermissionDef(permission, (err, data) => {
if (err) { if (err) {
console.error('getPermissionDef failed:' + err.message); console.error('getPermissionDef failed:' + err.message);
} else { } else {
......
...@@ -4525,10 +4525,10 @@ async function getCacheDir(){ ...@@ -4525,10 +4525,10 @@ async function getCacheDir(){
} }
let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let currStat = await fs.stat(path); fs.stat(path).then((stat) => {
let buf = new ArrayBuffer(bufferSize); let buf = new ArrayBuffer(bufferSize);
let len = currStat.size % bufferSize == 0 ? Math.floor(currStat.size / bufferSize) : Math.floor(currStat.size / bufferSize + 1); let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
for (let i = 0;i < len; i++) { for (let i = 0;i < len; i++) {
let options = { let options = {
offset: i * bufferSize, offset: i * bufferSize,
length: bufferSize length: bufferSize
...@@ -4543,7 +4543,8 @@ for (let i = 0;i < len; i++) { ...@@ -4543,7 +4543,8 @@ for (let i = 0;i < len; i++) {
} }
}) })
}) })
} }
});
``` ```
### write<sup>8+</sup> ### write<sup>8+</sup>
...@@ -4578,10 +4579,10 @@ async function getCacheDir(){ ...@@ -4578,10 +4579,10 @@ async function getCacheDir(){
} }
let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let currStat = await fs.stat(path); fs.stat(path).then((stat) => {
let buf = new ArrayBuffer(bufferSize); let buf = new ArrayBuffer(bufferSize);
let len = currStat.size % bufferSize == 0 ? Math.floor(currStat.size / bufferSize) : Math.floor(currStat.size / bufferSize + 1); let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
for (let i = 0;i < len; i++) { for (let i = 0;i < len; i++) {
let options = { let options = {
offset: i * bufferSize, offset: i * bufferSize,
length: bufferSize length: bufferSize
...@@ -4592,7 +4593,8 @@ for (let i = 0;i < len; i++) { ...@@ -4592,7 +4593,8 @@ for (let i = 0;i < len; i++) {
} catch(err) { } catch(err) {
console.error(`audioRenderer.write err: ${err}`); console.error(`audioRenderer.write err: ${err}`);
} }
} }
});
``` ```
### getAudioTime<sup>8+</sup> ### getAudioTime<sup>8+</sup>
......
...@@ -41,7 +41,7 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor'; ...@@ -41,7 +41,7 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor';
| 名称 | 说明 | | 名称 | 说明 |
| ---------- | --------------- | | ---------- | --------------- |
| app | 监听应用事件。 | | add | 监听应用事件。 |
| update | 监听更新事件。 | | update | 监听更新事件。 |
| remove | 监听删除事件。 | | remove | 监听删除事件。 |
......
...@@ -40,7 +40,7 @@ getPreferences(context: Context, name: string, callback: AsyncCallback&lt;Prefer ...@@ -40,7 +40,7 @@ getPreferences(context: Context, name: string, callback: AsyncCallback&lt;Prefer
| -------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ |
| context | Context | 是 | 应用上下文。<br>FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)<br>Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | context | Context | 是 | 应用上下文。<br>FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)<br>Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 |
| name | string | 是 | Preferences实例的名称。 | | name | string | 是 | Preferences实例的名称。 |
| callback | AsyncCallback&lt;[Preferences](#preferences)&gt; | 是 | 回调函数。当获取Preferences实例成功,err为undefined,返回Preferences实例;否则err为错误。 | | callback | AsyncCallback&lt;[Preferences](#preferences)&gt; | 是 | 回调函数。当获取Preferences实例成功,err为undefined,返回Preferences实例;否则err为错误对象。 |
**示例:** **示例:**
...@@ -177,7 +177,7 @@ deletePreferences(context: Context, name: string, callback: AsyncCallback&lt;voi ...@@ -177,7 +177,7 @@ deletePreferences(context: Context, name: string, callback: AsyncCallback&lt;voi
| -------- | ------------------------------------- | ---- | ---------------------------------------------------- | | -------- | ------------------------------------- | ---- | ---------------------------------------------------- |
| context | Context | 是 | 应用上下文。<br>FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)<br>Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | context | Context | 是 | 应用上下文。<br>FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)<br>Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 |
| name | string | 是 | Preferences实例的名称。 | | name | string | 是 | Preferences实例的名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当移除成功,err为undefined,否则为错误。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当移除成功,err为undefined,否则为错误对象。 |
**错误码:** **错误码:**
...@@ -320,7 +320,7 @@ removePreferencesFromCache(context: Context, name: string, callback: AsyncCallba ...@@ -320,7 +320,7 @@ removePreferencesFromCache(context: Context, name: string, callback: AsyncCallba
| -------- | ------------------------------------- | ---- | ---------------------------------------------------- | | -------- | ------------------------------------- | ---- | ---------------------------------------------------- |
| context | Context | 是 | 应用上下文。<br>FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)<br>Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | context | Context | 是 | 应用上下文。<br>FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)<br>Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 |
| name | string | 是 | Preferences实例的名称。 | | name | string | 是 | Preferences实例的名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当移除成功,err为undefined,否则为错误。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当移除成功,err为undefined,否则为错误对象。 |
**示例:** **示例:**
...@@ -452,7 +452,7 @@ get(key: string, defValue: ValueType, callback: AsyncCallback&lt;ValueType&gt;): ...@@ -452,7 +452,7 @@ get(key: string, defValue: ValueType, callback: AsyncCallback&lt;ValueType&gt;):
| -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ |
| key | string | 是 | 要获取的存储Key名称,不能为空。 | | key | string | 是 | 要获取的存储Key名称,不能为空。 |
| defValue | [ValueType](#valuetype) | 是 | 默认返回值。支持number、string、boolean、Array\<number>、Array\<string>、Array\<boolean>类型。 | | defValue | [ValueType](#valuetype) | 是 | 默认返回值。支持number、string、boolean、Array\<number>、Array\<string>、Array\<boolean>类型。 |
| callback | AsyncCallback&lt;[ValueType](#valuetype)&gt; | 是 | 回调函数。当获取成功时,err为undefined,data为键对应的值;否则err为错误。 | | callback | AsyncCallback&lt;[ValueType](#valuetype)&gt; | 是 | 回调函数。当获取成功时,err为undefined,data为键对应的值;否则err为错误对象。 |
**示例:** **示例:**
...@@ -519,7 +519,7 @@ getAll(callback: AsyncCallback&lt;Object&gt;): void; ...@@ -519,7 +519,7 @@ getAll(callback: AsyncCallback&lt;Object&gt;): void;
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback&lt;Object&gt; | 是 | 回调函数。当获取成功,err为undefined,value为含有所有键值的Object对象;否则err为错误。 | | callback | AsyncCallback&lt;Object&gt; | 是 | 回调函数。当获取成功,err为undefined,value为含有所有键值的Object对象;否则err为错误对象。 |
**示例:** **示例:**
...@@ -585,7 +585,7 @@ put(key: string, value: ValueType, callback: AsyncCallback&lt;void&gt;): void ...@@ -585,7 +585,7 @@ put(key: string, value: ValueType, callback: AsyncCallback&lt;void&gt;): void
| -------- | ------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| key | string | 是 | 要修改的存储的Key,不能为空。 | | key | string | 是 | 要修改的存储的Key,不能为空。 |
| value | [ValueType](#valuetype) | 是 | 存储的新值。支持number、string、boolean、Array\<number>、Array\<string>、Array\<boolean>类型。 | | value | [ValueType](#valuetype) | 是 | 存储的新值。支持number、string、boolean、Array\<number>、Array\<string>、Array\<boolean>类型。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当数据写入成功,err为undefined;否则为错误。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当数据写入成功,err为undefined;否则为错误对象。 |
**示例:** **示例:**
...@@ -730,7 +730,7 @@ delete(key: string, callback: AsyncCallback&lt;void&gt;): void ...@@ -730,7 +730,7 @@ delete(key: string, callback: AsyncCallback&lt;void&gt;): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------------------------- | | -------- | ------------------------- | ---- | ---------------------------------------------------- |
| key | string | 是 | 要删除的存储Key名称,不能为空。 | | key | string | 是 | 要删除的存储Key名称,不能为空。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当删除成功,err为undefined;否则为错误。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当删除成功,err为undefined;否则为错误对象。 |
**示例:** **示例:**
...@@ -797,7 +797,7 @@ flush(callback: AsyncCallback&lt;void&gt;): void ...@@ -797,7 +797,7 @@ flush(callback: AsyncCallback&lt;void&gt;): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------------------------- | | -------- | ------------------------- | ---- | ---------------------------------------------------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当保存成功,err为undefined;否则为错误。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当保存成功,err为undefined;否则为错误对象。 |
**示例:** **示例:**
...@@ -858,7 +858,7 @@ clear(callback: AsyncCallback&lt;void&gt;): void ...@@ -858,7 +858,7 @@ clear(callback: AsyncCallback&lt;void&gt;): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------------------------- | | -------- | ------------------------- | ---- | ---------------------------------------------------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当清除成功,err为undefined;否则为错误。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当清除成功,err为undefined;否则为错误对象。 |
**示例:** **示例:**
......
...@@ -18,14 +18,14 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype'; ...@@ -18,14 +18,14 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype';
**系统能力:** SystemCapability.MiscServices.InputMethodFramework **系统能力:** SystemCapability.MiscServices.InputMethodFramework
| 名称 | 类型 | 可读 | 可写 | 必选 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| label | string | 是 | 否 | 否 | 输入法子类型的标签。 | | label | string | 是 | 否 | 非必填。输入法子类型的标签。 |
| name | string | 是 | 否 | 是 | 输入法应用的包名。 | | name | string | 是 | 否 | 必填。输入法应用的包名。 |
| id | string | 是 | 否 | 是 | 输入法子类型的id。 | | id | string | 是 | 否 | 必填。输入法子类型的id。 |
| mode | string | 是 | 否 | 否 | 输入法子类型的模式,包括upper(大写)和lower(小写)。 | | mode | string | 是 | 否 | 非必填。输入法子类型的模式,包括upper(大写)和lower(小写)。 |
| locale | string | 是 | 否 | 是 | 输入法子类型的方言版本。 | | locale | string | 是 | 否 | 必填。输入法子类型的方言版本。 |
| language | string | 是 | 否 | 是 | 输入法子类型的语言。 | | language | string | 是 | 否 | 必填。 输入法子类型的语言。 |
| icon | string | 是 | 否 | 否 | 输入法子类型的图标。 | | icon | string | 是 | 否 | 非必填。输入法子类型的图标。 |
| iconId | number | 是 | 否 | 否 | 输入法子类型的图标id。 | | iconId | number | 是 | 否 | 非必填。输入法子类型的图标id。 |
| extra | object | 是 | 是 | 是 | 输入法子类型的其他信息。 | | extra | object | 是 | 是 | 必填。输入法子类型的其他信息。 |
...@@ -1286,7 +1286,7 @@ setData(data: PasteData, callback: AsyncCallback&lt;void&gt;): void ...@@ -1286,7 +1286,7 @@ setData(data: PasteData, callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
```js ```js
let pasteData = pasteboard.createPlainTextData('content'); let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'content');
let systemPasteboard = pasteboard.getSystemPasteboard(); let systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.setData(pasteData, (err, data) => { systemPasteboard.setData(pasteData, (err, data) => {
if (err) { if (err) {
...@@ -1329,7 +1329,7 @@ setData(data: PasteData): Promise&lt;void&gt; ...@@ -1329,7 +1329,7 @@ setData(data: PasteData): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
let pasteData = pasteboard.createPlainTextData('content'); let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'content');
let systemPasteboard = pasteboard.getSystemPasteboard(); let systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.setData(pasteData).then((data) => { systemPasteboard.setData(pasteData).then((data) => {
console.info('Succeeded in setting PasteData.'); console.info('Succeeded in setting PasteData.');
......
...@@ -292,14 +292,6 @@ setSize(size: number): void ...@@ -292,14 +292,6 @@ setSize(size: number): void
| ------ | ------ | ---- | ------ | | ------ | ------ | ---- | ------ |
| size | number | 是 | MessageSequence实例的数据大小。以字节为单位。 | | size | number | 是 | MessageSequence实例的数据大小。以字节为单位。 |
**错误码:**
以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md)
| 错误码ID | 错误信息 |
| -------- | -------- |
| 1900009 | write data to message sequence failed |
**示例:** **示例:**
```ts ```ts
...@@ -333,7 +325,6 @@ setCapacity(size: number): void ...@@ -333,7 +325,6 @@ setCapacity(size: number): void
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 1900009 | write data to message sequence failed |
| 1900011 | parcel memory alloc failed | | 1900011 | parcel memory alloc failed |
**示例:** **示例:**
...@@ -460,12 +451,6 @@ rewindRead(pos: number): void ...@@ -460,12 +451,6 @@ rewindRead(pos: number): void
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| pos | number | 是 | 开始读取数据的目标位置。 | | pos | number | 是 | 开始读取数据的目标位置。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | -------- |
| 1900010 | read data from message sequence failed |
**示例:** **示例:**
```ts ```ts
...@@ -498,12 +483,6 @@ rewindWrite(pos: number): void ...@@ -498,12 +483,6 @@ rewindWrite(pos: number): void
| ------ | ------ | ---- | ----- | | ------ | ------ | ---- | ----- |
| pos | number | 是 | 开始写入数据的目标位置。 | | pos | number | 是 | 开始写入数据的目标位置。 |
**错误码:**
| 错误码ID | 错误信息 |
| -------- | -------- |
| 1900009 | write data to message sequence failed |
**示例:** **示例:**
```ts ```ts
...@@ -2944,8 +2923,8 @@ writeAshmem(ashmem: Ashmem): void ...@@ -2944,8 +2923,8 @@ writeAshmem(ashmem: Ashmem): void
以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md)
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | ------- |
| 1900009 | write data to message sequence failed | | 1900003 | write to ashmem failed |
**示例:** **示例:**
...@@ -2986,7 +2965,7 @@ readAshmem(): Ashmem ...@@ -2986,7 +2965,7 @@ readAshmem(): Ashmem
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 1900010 | read data from message sequence failed | | 1900004 | read from ashmem failed |
**示例:** **示例:**
...@@ -5958,7 +5937,7 @@ registerDeathRecipient(recipient: DeathRecipient, flags: number): void ...@@ -5958,7 +5937,7 @@ registerDeathRecipient(recipient: DeathRecipient, flags: number): void
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 1900005 | only proxy object permitted | | 1900008 | proxy or remote object is invalid |
### addDeathrecipient<sup>(deprecated)</sup> ### addDeathrecipient<sup>(deprecated)</sup>
...@@ -6004,7 +5983,7 @@ unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void ...@@ -6004,7 +5983,7 @@ unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 1900005 | only proxy object permitted | | 1900008 | proxy or remote object is invalid |
### removeDeathRecipient<sup>(deprecated)</sup> ### removeDeathRecipient<sup>(deprecated)</sup>
......
...@@ -69,14 +69,6 @@ create(name: string, type: RunningLockType, callback: AsyncCallback&lt;RunningLo ...@@ -69,14 +69,6 @@ create(name: string, type: RunningLockType, callback: AsyncCallback&lt;RunningLo
| type | [RunningLockType](#runninglocktype) | 是 | 要创建的锁的类型。 | | type | [RunningLockType](#runninglocktype) | 是 | 要创建的锁的类型。 |
| callback | AsyncCallback<[RunningLock](#runninglock)> | 是 | 回调函数。当创建锁成功,err为undefined,data为创建的RunningLock;否则为错误对象。 | | callback | AsyncCallback<[RunningLock](#runninglock)> | 是 | 回调函数。当创建锁成功,err为undefined,data为创建的RunningLock;否则为错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[RunningLock锁错误码](../errorcodes/errorcode-runninglock.md)
| 错误码ID | 错误信息 |
|---------|----------|
| 4900101 | If connecting to the service failed. |
**示例:** **示例:**
```js ```js
...@@ -112,14 +104,6 @@ create(name: string, type: RunningLockType): Promise&lt;RunningLock&gt; ...@@ -112,14 +104,6 @@ create(name: string, type: RunningLockType): Promise&lt;RunningLock&gt;
| ------------------------------------------ | ------------------------------------ | | ------------------------------------------ | ------------------------------------ |
| Promise&lt;[RunningLock](#runninglock)&gt; | Promise对象,返回RunningLock锁对象。 | | Promise&lt;[RunningLock](#runninglock)&gt; | Promise对象,返回RunningLock锁对象。 |
**错误码:**
以下错误码的详细介绍请参见[RunningLock锁错误码](../errorcodes/errorcode-runninglock.md)
| 错误码ID | 错误信息 |
|---------|----------|
| 4900101 | If connecting to the service failed. |
**示例:** **示例:**
```js ```js
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## 导入模块 ## 导入模块
```js ```js
import screenlock from '@ohos.screenLock'; import screenLock from '@ohos.screenLock';
``` ```
## EventType<sup>9+</sup> ## EventType<sup>9+</sup>
...@@ -50,7 +50,7 @@ import screenlock from '@ohos.screenLock'; ...@@ -50,7 +50,7 @@ import screenlock from '@ohos.screenLock';
| eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 | | eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 |
| params | string | 是 | 系统事件参数。 | | params | string | 是 | 系统事件参数。 |
## screenlock.isLocked<sup>9+</sup> ## screenLock.isLocked<sup>9+</sup>
isLocked(): boolean isLocked(): boolean
...@@ -69,10 +69,10 @@ isLocked(): boolean ...@@ -69,10 +69,10 @@ isLocked(): boolean
**示例:** **示例:**
```js ```js
let isLocked = screenlock.isLocked(); let isLocked = screenLock.isLocked();
``` ```
## screenlock.unlock<sup>9+</sup> ## screenLock.unlock<sup>9+</sup>
unlock(callback: AsyncCallback&lt;boolean&gt;): void unlock(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -98,17 +98,17 @@ unlock(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -98,17 +98,17 @@ unlock(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.unlock((err, data) => { screenLock.unlock((err, data) => {
if (err) { if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`unlock the screen successfully. result: ${data}`); console.info(`Succeeded in unlocking the screen. result: ${data}`);
}); });
``` ```
## screenlock.unlock<sup>9+</sup> ## screenLock.unlock<sup>9+</sup>
unlock(): Promise&lt;boolean&gt; unlock(): Promise&lt;boolean&gt;
...@@ -134,15 +134,15 @@ unlock(): Promise&lt;boolean&gt; ...@@ -134,15 +134,15 @@ unlock(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.unlock().then((data) => { screenLock.unlock().then((data) => {
console.info(`unlock the screen successfully. result: ${data}`); console.info(`Succeeded in unlocking the screen. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.lock<sup>9+</sup> ## screenLock.lock<sup>9+</sup>
lock(callback: AsyncCallback&lt;boolean&gt;): void lock(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -168,17 +168,17 @@ lock(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -168,17 +168,17 @@ lock(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.lock((err, data) => { screenLock.lock((err, data) => {
if (err) { if (err) {
console.error(`Failed to lock the screen, because: ${err.message}`); console.error(`Failed to lock the screen, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`lock the screen successfully. result: ${data}`); console.info(`Succeeded in locking the screen. result: ${data}`);
}); });
``` ```
## screenlock.lock<sup>9+</sup> ## screenLock.lock<sup>9+</sup>
lock(): Promise&lt;boolean&gt; lock(): Promise&lt;boolean&gt;
...@@ -204,15 +204,15 @@ lock(): Promise&lt;boolean&gt; ...@@ -204,15 +204,15 @@ lock(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.lock().then((data) => { screenLock.lock().then((data) => {
console.info(`lock the screen successfully. result: ${data}`); console.info(`Succeeded in locking the screen. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to lock the screen, because: ${err.message}`); console.error(`Failed to lock the screen, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.onSystemEvent<sup>9+</sup> ## screenLock.onSystemEvent<sup>9+</sup>
onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean
...@@ -244,17 +244,17 @@ onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean ...@@ -244,17 +244,17 @@ onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean
**示例:** **示例:**
```js ```js
try { try {
let isSuccess = screenlock.onSystemEvent((event) => { let isSuccess = screenLock.onSystemEvent((event) => {
console.log(`Register the system event which related to screenlock successfully. eventType: ${event.eventType}`) console.log(`Succeeded in Registering the system event which related to screenlock. eventType: ${event.eventType}`)
}); });
} catch (err) { } catch (err) {
console.error(`Failed to register the system event which related to screenlock, because: ${err.message}`) console.error(`Failed to register the system event which related to screenlock, Code: ${err.code}, message: ${err.message}`)
} }
``` ```
## screenlock.sendScreenLockEvent<sup>9+</sup> ## screenLock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt;boolean&gt;): void sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt;boolean&gt;): void
...@@ -282,17 +282,17 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt ...@@ -282,17 +282,17 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt
**示例:** **示例:**
```js ```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => { screenLock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => {
if (err) { if (err) {
console.error(`Failed to send screenlock event, because: ${err.message}`); console.error(`Failed to send screenlock event, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`Send screenlock event successfully. result: ${result}`); console.info(`Succeeded in Sending screenlock event. result: ${result}`);
}); });
``` ```
## screenlock.sendScreenLockEvent<sup>9+</sup> ## screenLock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt; sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt;
...@@ -325,15 +325,15 @@ sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt; ...@@ -325,15 +325,15 @@ sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => { screenLock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => {
console.info(`Send screenlock event successfully. result: ${result}`); console.info(`Succeeded in Sending screenlock event. result: ${result}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to send screenlock event, because: ${err.message}`); console.error(`Failed to send screenlock event, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.isScreenLocked<sup>(deprecated)</sup> ## screenLock.isScreenLocked<sup>(deprecated)</sup>
isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -353,17 +353,17 @@ isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -353,17 +353,17 @@ isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.isScreenLocked((err, data)=>{ screenLock.isScreenLocked((err, data)=>{
if (err) { if (err) {
console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`); console.error(`Failed to obtain whether the screen is locked, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`Obtain whether the screen is locked successfully. result: ${data}`); console.info(`Succeeded in Obtaining whether the screen is locked. result: ${data}`);
}); });
``` ```
## screenlock.isScreenLocked<sup>(deprecated)</sup> ## screenLock.isScreenLocked<sup>(deprecated)</sup>
isScreenLocked(): Promise&lt;boolean&gt; isScreenLocked(): Promise&lt;boolean&gt;
...@@ -383,15 +383,15 @@ isScreenLocked(): Promise&lt;boolean&gt; ...@@ -383,15 +383,15 @@ isScreenLocked(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.isScreenLocked().then((data) => { screenLock.isScreenLocked().then((data) => {
console.info(`Obtain whether the screen is locked successfully. result: ${data}`); console.info(`Succeeded in Obtaining whether the screen is locked. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`); console.error(`Failed to obtain whether the screen is locked, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.isSecureMode<sup>(deprecated)</sup> ## screenLock.isSecureMode<sup>(deprecated)</sup>
isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -411,17 +411,17 @@ isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -411,17 +411,17 @@ isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.isSecureMode((err, data)=>{ screenLock.isSecureMode((err, data)=>{
if (err) { if (err) {
console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`); console.error(`Failed to obtain whether the device is in secure mode, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`Obtain whether the device is in secure mode successfully. result: ${data}`); console.info(`Succeeded in Obtaining whether the device is in secure mode. result: ${data}`);
}); });
``` ```
## screenlock.isSecureMode<sup>(deprecated)</sup> ## screenLock.isSecureMode<sup>(deprecated)</sup>
isSecureMode(): Promise&lt;boolean&gt; isSecureMode(): Promise&lt;boolean&gt;
...@@ -441,14 +441,15 @@ isSecureMode(): Promise&lt;boolean&gt; ...@@ -441,14 +441,15 @@ isSecureMode(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.isSecureMode().then((data) => { screenLock.isSecureMode().then((data) => {
console.info(`Obtain whether the device is in secure mode successfully. result: ${data}`); console.info(`Succeeded in Obtaining whether the device is in secure mode. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`); console.error(`Failed to obtain whether the device is in secure mode, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.unlockScreen<sup>(deprecated)</sup>
## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(callback: AsyncCallback&lt;void&gt;): void unlockScreen(callback: AsyncCallback&lt;void&gt;): void
...@@ -468,17 +469,17 @@ unlockScreen(callback: AsyncCallback&lt;void&gt;): void ...@@ -468,17 +469,17 @@ unlockScreen(callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
```js ```js
screenlock.unlockScreen((err) => { screenLock.unlockScreen((err) => {
if (err) { if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info('unlock the screen successfully.'); console.info(`Succeeded unlocking the screen.`);
}); });
``` ```
## screenlock.unlockScreen<sup>(deprecated)</sup> ## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(): Promise&lt;void&gt; unlockScreen(): Promise&lt;void&gt;
...@@ -498,10 +499,10 @@ unlockScreen(): Promise&lt;void&gt; ...@@ -498,10 +499,10 @@ unlockScreen(): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
screenlock.unlockScreen().then(() => { screenLock.unlockScreen().then(() => {
console.info('unlock the screen successfully.'); console.info('Succeeded unlocking the screen.');
}).catch((err) => { }).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
...@@ -123,7 +123,7 @@ off(activity: ActivityType, event: ActivityEvent, callback?: Callback&lt;Activit ...@@ -123,7 +123,7 @@ off(activity: ActivityType, event: ActivityEvent, callback?: Callback&lt;Activit
| -------------------- | -------------------------------------------------- | ---- | ---------------------------- | | -------------------- | -------------------------------------------------- | ---- | ---------------------------- |
| activity | [ActivityType](#activitytype) | 是 | 设备状态能力类型。 | | activity | [ActivityType](#activitytype) | 是 | 设备状态能力类型。 |
| event | [ActivityEvent](#activityevent) | 是 | 事件类型。 | | event | [ActivityEvent](#activityevent) | 是 | 事件类型。 |
| callback | Callback<[ActivityResponse](#activityresponse)\> | 否 | 回调函数,接收上报状态变化事件,如果没有传递callback参数,会移除该进程下订阅该类型得所有callback。 | | callback | Callback\<[ActivityResponse](#activityresponse)> | 否 | 回调函数,接收上报状态变化事件。 |
**示例:** **示例:**
......
...@@ -137,9 +137,9 @@ hasRight(deviceName: string): boolean ...@@ -137,9 +137,9 @@ hasRight(deviceName: string): boolean
**示例:** **示例:**
```js ```js
let devicesName="1-1"; let devicesName= "1-1";
let bool = usb.hasRight(devicesName); let bool = usb.hasRight(devicesName);
console.log(bool); console.log(`${bool}`);
``` ```
## usb.requestRight ## usb.requestRight
...@@ -165,7 +165,7 @@ requestRight(deviceName: string): Promise&lt;boolean&gt; ...@@ -165,7 +165,7 @@ requestRight(deviceName: string): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
let devicesName="1-1"; let devicesName= "1-1";
usb.requestRight(devicesName).then((ret) => { usb.requestRight(devicesName).then((ret) => {
console.log(`requestRight = ${ret}`); console.log(`requestRight = ${ret}`);
}); });
...@@ -375,10 +375,17 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: ...@@ -375,10 +375,17 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?:
**示例:** **示例:**
```js ```js
let param = new usb.USBControlParams(); let param = {
request: 0,
reqType: 0,
target:0,
value: 0,
index: 0,
data: null
};
usb.controlTransfer(devicepipe, param).then((ret) => { usb.controlTransfer(devicepipe, param).then((ret) => {
console.log(`controlTransfer = ${ret}`); console.log(`controlTransfer = ${ret}`);
}) });
``` ```
## usb.bulkTransfer ## usb.bulkTransfer
...@@ -500,7 +507,7 @@ usbFunctionsToString(funcs: FunctionType): string ...@@ -500,7 +507,7 @@ usbFunctionsToString(funcs: FunctionType): string
**示例:** **示例:**
```js ```js
let funcs = usb.ACM | usb.ECM; let funcs = usb.FunctionType.ACM | usb.FunctionType.ECM;
let ret = usb.usbFunctionsToString(funcs); let ret = usb.usbFunctionsToString(funcs);
``` ```
...@@ -529,8 +536,12 @@ setCurrentFunctions(funcs: FunctionType): Promise\<boolean\> ...@@ -529,8 +536,12 @@ setCurrentFunctions(funcs: FunctionType): Promise\<boolean\>
**示例:** **示例:**
```js ```js
let funcs = usb.HDC; let funcs = usb.FunctionType.HDC;
let ret = usb.setCurrentFunctions(funcs); usb.setCurrentFunctions(funcs).then(() => {
console.info('usb setCurrentFunctions successfully.');
}).catch(err => {
console.error('usb setCurrentFunctions failed: ' + err.code + ' message: ' + err.message);
});
``` ```
## usb.getCurrentFunctions<sup>9+</sup> ## usb.getCurrentFunctions<sup>9+</sup>
......
...@@ -531,7 +531,7 @@ usb.requestRight(devicesList[0].name); ...@@ -531,7 +531,7 @@ usb.requestRight(devicesList[0].name);
let devicepipe = usb.connectDevice(devicesList[0]); let devicepipe = usb.connectDevice(devicesList[0]);
usb.controlTransfer(devicepipe, param).then((ret) => { usb.controlTransfer(devicepipe, param).then((ret) => {
console.log(`controlTransfer = ${ret}`); console.log(`controlTransfer = ${ret}`);
}) });
``` ```
## usb.bulkTransfer ## usb.bulkTransfer
......
...@@ -2788,7 +2788,16 @@ class TestRemoteObject extends rpc.RemoteObject { ...@@ -2788,7 +2788,16 @@ class TestRemoteObject extends rpc.RemoteObject {
} }
let token = new TestRemoteObject('testObject'); let token = new TestRemoteObject('testObject');
let windowClass = null;
let config = {name: "dialogWindow", windowType: window.WindowType.TYPE_DIALOG, ctx: this.context};
try { try {
window.createWindow(config, (err, data) => {
if (err.code) {
console.error('Failed to create the window. Cause: ' + JSON.stringify(err));
return;
}
windowClass = data;
});
windowClass.bindDialogTarget(token, () => { windowClass.bindDialogTarget(token, () => {
console.info('Dialog Window Need Destroy.'); console.info('Dialog Window Need Destroy.');
}, (err) => { }, (err) => {
...@@ -2861,7 +2870,16 @@ class TestRemoteObject extends rpc.RemoteObject { ...@@ -2861,7 +2870,16 @@ class TestRemoteObject extends rpc.RemoteObject {
} }
let token = new TestRemoteObject('testObject'); let token = new TestRemoteObject('testObject');
let windowClass = null;
let config = {name: "dialogWindow", windowType: window.WindowType.TYPE_DIALOG, ctx: this.context};
try { try {
window.createWindow(config, (err, data) => {
if (err.code) {
console.error('Failed to create the window. Cause: ' + JSON.stringify(err));
return;
}
windowClass = data;
});
let promise = windowClass.bindDialogTarget(token, () => { let promise = windowClass.bindDialogTarget(token, () => {
console.info('Dialog Window Need Destroy.'); console.info('Dialog Window Need Destroy.');
}); });
...@@ -2875,6 +2893,172 @@ try { ...@@ -2875,6 +2893,172 @@ try {
} }
``` ```
### bindDialogTarget<sup>9+</sup>
bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback&lt;void&gt;, callback: AsyncCallback&lt;void&gt;): void
绑定模态窗口与目标窗口并添加模态窗口销毁监听,使用callback异步回调。
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------------------------- | ---- | -------------------- |
| requestInfo | [dialogRequest.RequestInfo](js-apis-app-ability-dialogRequest.md#requestinfo) | 是 | 目标窗口RequestInfo值。 |
| deathCallback | Callback&lt;void&gt; | 是 | 模态窗口销毁监听。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**错误码:**
以下错误码的详细介绍请参见[窗口错误码](../errorcodes/errorcode-window.md)
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 1300002 | This window state is abnormal. |
| 1300003 | This window manager service works abnormally. |
**示例:**
```js
import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility';
import rpc from '@ohos.rpc';
import dialogRequest from '@ohos.app.ability.dialogRequest';
import window from '@ohos.window';
export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate');
}
onRequest(want, startId) {
console.info('onRequest');
let windowClass = null;
let config = {name: "dialogWindow", windowType: window.WindowType.TYPE_DIALOG, ctx: this.context};
try {
window.createWindow(config, (err, data) => {
if (err.code) {
console.error('Failed to create the window. Cause: ' + JSON.stringify(err));
return;
}
windowClass = data;
});
let requestInfo = dialogRequest.getRequestInfo(want)
windowClass.bindDialogTarget(requestInfo, () => {
console.info('Dialog Window Need Destroy.');
}, (err) => {
if (err.code) {
console.error('Failed to bind dialog target. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in binding dialog target.');
});
} catch(err) {
console.error('Failed to bind dialog target. Cause:' + JSON.stringify(err))
}
}
onConnect(want) {
console.info('onConnect');
}
onDisconnect(want) {
console.info('onDisconnect');
}
onDestroy() {
console.info('onDestroy');
}
}
```
### bindDialogTarget<sup>9+</sup>
bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback&lt;void&gt;): Promise&lt;void&gt;
绑定模态窗口与目标窗口并添加模态窗口销毁监听,使用Promise异步回调。
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------------------------- | ---- | -------------------- |
| requestInfo | [dialogRequest.RequestInfo](js-apis-app-ability-dialogRequest.md#requestinfo) | 是 | 目标窗口RequestInfo值。 |
| deathCallback | Callback&lt;void&gt; | 是 | 模态窗口销毁监听。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ------------------------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**错误码:**
以下错误码的详细介绍请参见[窗口错误码](../errorcodes/errorcode-window.md)
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 1300002 | This window state is abnormal. |
| 1300003 | This window manager service works abnormally. |
**示例:**
```js
import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility';
import rpc from '@ohos.rpc';
import dialogRequest from '@ohos.app.ability.dialogRequest';
import window from '@ohos.window';
export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate');
}
onRequest(want, startId) {
console.info('onRequest');
let windowClass = null;
let config = {name: "dialogWindow", windowType: window.WindowType.TYPE_DIALOG, ctx: this.context};
try {
window.createWindow(config, (err, data) => {
if (err.code) {
console.error('Failed to create the window. Cause: ' + JSON.stringify(err));
return;
}
windowClass = data;
});
let requestInfo = dialogRequest.getRequestInfo(want)
let promise = windowClass.bindDialogTarget(requestInfo, () => {
console.info('Dialog Window Need Destroy.');
});
promise.then(()=> {
console.info('Succeeded in binding dialog target.');
}).catch((err)=>{
console.error('Failed to bind dialog target. Cause:' + JSON.stringify(err));
});
} catch(err) {
console.error('Failed to bind dialog target. Cause:' + JSON.stringify(err))
}
}
onConnect(want) {
console.info('onConnect');
}
onDisconnect(want) {
console.info('onDisconnect');
}
onDestroy() {
console.info('onDestroy');
}
}
```
### isWindowSupportWideGamut<sup>9+</sup> ### isWindowSupportWideGamut<sup>9+</sup>
isWindowSupportWideGamut(callback: AsyncCallback&lt;boolean&gt;): void isWindowSupportWideGamut(callback: AsyncCallback&lt;boolean&gt;): void
......
...@@ -240,7 +240,7 @@ decompressFile(inFile: string, outFile: string, options: Options, callback: Asyn ...@@ -240,7 +240,7 @@ decompressFile(inFile: string, outFile: string, options: Options, callback: Asyn
以下错误码的详细介绍请参见[ohos.zlib错误码](../errorcodes/errorcode-zlib.md) 以下错误码的详细介绍请参见[ohos.zlib错误码](../errorcodes/errorcode-zlib.md)
| 错误码ID | 错误信息 | 错误码ID | 错误信息 |
| -------- | --------------------------------------| | -------- | --------------------------------------|
| 900001 | The Input source file is invalid. | | 900001 | The Input source file is invalid. |
| 900002 | The Input destination file is invalid. | | 900002 | The Input destination file is invalid. |
......
...@@ -31,7 +31,7 @@ Toggle(options: { type: ToggleType, isOn?: boolean }) ...@@ -31,7 +31,7 @@ Toggle(options: { type: ToggleType, isOn?: boolean })
| 名称 | 描述 | | 名称 | 描述 |
| -------- | ---------------- | | -------- | ---------------- |
| Checkbox | 提供单选框样式。<br>**说明:**<br/>[通用属性margin](ts-universal-attributes-size.md)的默认值为:<br>{<br>&nbsp;top: 12 px,<br>&nbsp;right: 12 px,<br>&nbsp;bottom: 12 px,<br>&nbsp;left: 12 px<br> } | | Checkbox | 提供单选框样式。<br>**说明:**<br/>[通用属性margin](ts-universal-attributes-size.md)的默认值为:<br>{<br>&nbsp;top: 14 px,<br>&nbsp;right: 14 px,<br>&nbsp;bottom: 14 px,<br>&nbsp;left: 14 px<br> } |
| Button | 提供状态按钮样式,如果子组件有文本设置,则相应的文本内容会显示在按钮内部。 | | Button | 提供状态按钮样式,如果子组件有文本设置,则相应的文本内容会显示在按钮内部。 |
| Switch | 提供开关样式。<br>**说明:**<br/>[通用属性margin](ts-universal-attributes-size.md)默认值为:<br>{<br/>&nbsp;top: 14 vp,<br/>&nbsp;right:6 vp,<br/>&nbsp;bottom: 14 vp,<br/>&nbsp;left: 6 vp<br/> } | | Switch | 提供开关样式。<br>**说明:**<br/>[通用属性margin](ts-universal-attributes-size.md)默认值为:<br>{<br/>&nbsp;top: 14 vp,<br/>&nbsp;right:6 vp,<br/>&nbsp;bottom: 14 vp,<br/>&nbsp;left: 6 vp<br/> } |
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
| 名称 | 功能描述 | | 名称 | 功能描述 |
| ---------------------------------------- | ---------------------------------------- | | ---------------------------------------- | ---------------------------------------- |
| onVisibleAreaChange(ratios: Array\<number>, event: (isVisible: boolean, currentRatio: number) => void) | 组件可见区域变化时触发该回调。<br/>-ratios:阈值数组。其中,每个阈值代表组件可见面积(即组件在屏幕显示区的面积)与组件自身面积的比值。当组件可见面积与自身面积的比值大于或小于阈值时,均会触发该回调。每个阈值的取值范围为[0.0, 1.0],如果开发者设置的阈值超出该范围,则会实际取值0.0或1.0.<br/>-isVisible:表示组件的可见面积与自身面积的比值是否大于阈值,true表示大于,false表示小于。<br/>-currentRatio:触发回调时,组件可见面积与自身面积的比值。 | | onVisibleAreaChange(ratios: Array\<number>, event: (isVisible: boolean, currentRatio: number) => void) | 组件可见区域变化时触发该回调。<br/>-ratios:阈值数组。其中,每个阈值代表组件可见面积(即组件在屏幕显示区的面积)与组件自身面积的比值。当组件可见面积与自身面积的比值大于或小于阈值时,均会触发该回调。每个阈值的取值范围为[0.0, 1.0],如果开发者设置的阈值超出该范围,则会实际取值0.0或1.0.<br/>-isVisible:表示组件的可见面积与自身面积的比值是否大于阈值,true表示大于,false表示小于。<br/>-currentRatio:触发回调时,组件可见面积与自身面积的比值。<br/>**说明:**<br/>该接口只适用于组件布局区域超出或离开了当前屏幕显示区域的情况,不支持组件堆叠(Stack)导致的面积不可见、使用offset或translate等图形变换接口导致的面积超出情况。 |
## 示例 ## 示例
......
...@@ -328,9 +328,3 @@ reqPermissions() { ...@@ -328,9 +328,3 @@ reqPermissions() {
} }
] ]
``` ```
## 相关实例
针对访问控制,有以下相关实例可供参考:
- [为应用添加运行时权限(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Ability/AccessPermission)
\ No newline at end of file
...@@ -90,7 +90,14 @@ ...@@ -90,7 +90,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebView Message Port Demo</title> <title>WebView Message Port Demo</title>
</head> </head>
<body>
<h1>WebView Message Port Demo</h1>
<div>
<input type="button" value="SendToEts" onclick="PostMsgToEts(msgFromJS.value);"/><br/>
<input id="msgFromJS" type="text" value="send this message from HTML to ets"/><br/>
</div>
<p class="output">display received message send from ets</p>
</body>
<script> <script>
var h5Port; var h5Port;
var output = document.querySelector('.output'); var output = document.querySelector('.output');
...@@ -107,7 +114,7 @@ ...@@ -107,7 +114,7 @@
msg = msg + result; msg = msg + result;
} else if (typeof(result) === 'object') { } else if (typeof(result) === 'object') {
if (result instanceof ArrayBuffer) { if (result instanceof ArrayBuffer) {
console.info(`received arraybuffer from html5, length is:` ${result.byteLength}`); console.info(`received arraybuffer from html5, length is: ${result.byteLength}`);
msg = msg + 'lenght is ' + result.byteLength; msg = msg + 'lenght is ' + result.byteLength;
} else { } else {
console.info('not support'); console.info('not support');
...@@ -130,14 +137,5 @@ ...@@ -130,14 +137,5 @@
} }
} }
</script> </script>
<body>
<h1>WebView Message Port Demo</h1>
<div>
<input type="button" value="SendToEts" onclick="PostMsgToEts(msgFromJS.value);"/><br/>
<input id="msgFromJS" type="text" value="send this message from HTML to ets"/><br/>
</div>
<p class="output">display received message send from ets</p>
</body>
</html> </html>
``` ```
...@@ -47,7 +47,7 @@ LCD接口通常可分为MIPI DSI接口、TTL接口和LVDS接口,常用的是MI ...@@ -47,7 +47,7 @@ LCD接口通常可分为MIPI DSI接口、TTL接口和LVDS接口,常用的是MI
![image](figures/TTL接口.png "TTL接口") ![image](figures/TTL接口.png "TTL接口")
TTL(Transistor Transistor Logic)即晶体管-晶体管逻辑,TTL电平信号由TTL器件产生,TTL器件是数字集成电路的一大门类,它采用双极型工艺制造,具有高速度、低功耗和品种多等特点。 ​TTL(Transistor Transistor Logic)即晶体管-晶体管逻辑,TTL电平信号由TTL器件产生,TTL器件是数字集成电路的一大门类,它采用双极型工艺制造,具有高速度、低功耗和品种多等特点。
TTL接口是并行方式传输数据的接口,有数据信号、时钟信号和控制信号(行同步、帧同步、数据有效信号等),在控制信号控制下完成数据传输。通常TTL接口的LCD,内部寄存器读写需要额外的外设接口,比如SPI接口、I2C接口等。 TTL接口是并行方式传输数据的接口,有数据信号、时钟信号和控制信号(行同步、帧同步、数据有效信号等),在控制信号控制下完成数据传输。通常TTL接口的LCD,内部寄存器读写需要额外的外设接口,比如SPI接口、I2C接口等。
...@@ -63,11 +63,13 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony ...@@ -63,11 +63,13 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony
### 接口说明 ### 接口说明
为了能够调整液晶显示屏的各项参数,与display建立显示通道,实现显示器的显示效果,LCD驱动需要通过`display :: host`注册PanelInfo结构体、接口信息,添加描述设备;LcdResetOn读取的pin脚信息,由SampleEntryInit初始化入口函数,并注册器件驱动接口,供平台驱动调用。
表1 LCD驱动适配所需接口 表1 LCD驱动适配所需接口
| 接口名 | 描述 | | 接口名 | 描述 |
| :------------------------------------------------------ | ------------------- | | :------------------------------------------------------ | ------------------- |
| display :: host | 设备描述配置 | | static int32_t MipiDsiInit(struct PanelInfo *info) | 适配对应的芯片平台驱动 |
| static int32_t LcdResetOn(void) | 设置Reset Pin脚状态 | | static int32_t LcdResetOn(void) | 设置Reset Pin脚状态 |
| int32_t SampleEntryInit(struct HdfDeviceObject *object) | 器件驱动入口函数 | | int32_t SampleEntryInit(struct HdfDeviceObject *object) | 器件驱动入口函数 |
...@@ -78,7 +80,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony ...@@ -78,7 +80,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony
2. 在SoC平台驱动适配层中适配对应的芯片平台驱动。 2. 在SoC平台驱动适配层中适配对应的芯片平台驱动。
3. 添加器件驱动,并在驱动入口函数Init中注册Panel驱动数据,驱动数据接口主要包括如下接口 3. 添加器件驱动,并在驱动入口函数Init中注册Panel驱动数据,驱动数据接口主要实现下述特性
- LCD上下电 - LCD上下电
根据LCD硬件连接,使用Platform接口层提供的GPIO操作接口操作对应LCD管脚,例如复位管脚、IOVCC管脚,上电时序参考LCD供应商提供的SPEC。 根据LCD硬件连接,使用Platform接口层提供的GPIO操作接口操作对应LCD管脚,例如复位管脚、IOVCC管脚,上电时序参考LCD供应商提供的SPEC。
...@@ -87,7 +89,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony ...@@ -87,7 +89,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony
根据LCD硬件接口,使用Platform接口层提供的I2C、SPI、MIPI等接口,下载LCD初始化序列,初始化参数序列可以参考LCD供应商提供的SPEC。 根据LCD硬件接口,使用Platform接口层提供的I2C、SPI、MIPI等接口,下载LCD初始化序列,初始化参数序列可以参考LCD供应商提供的SPEC。
4. (可选)根据需求实现HDF框架其他接口,比如Release接口 4. (可选)根据需求实现HDF框架其他接口。
5. (可选)根据需求使用HDF框架可创建其他设备节点,用于业务逻辑或者调试功能。 5. (可选)根据需求使用HDF框架可创建其他设备节点,用于业务逻辑或者调试功能。
...@@ -180,9 +182,9 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony ...@@ -180,9 +182,9 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony
} }
``` ```
3. 添加器件(drivers/hdf_core/framework/model/display/driver/panel/mipi_icn9700.c) 3. 添加器件
- 驱动定义相关接口信息 - 驱动定义相关接口信息(drivers/hdf_core/framework/model/display/driver/panel/mipi_icn9700.c)
```c++ ```c++
#define RESET_GPIO 5 #define RESET_GPIO 5
...@@ -204,7 +206,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony ...@@ -204,7 +206,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony
#define FRAME_RATE 60 #define FRAME_RATE 60
``` ```
- 定义PanelInfo结构体 - 定义PanelInfo结构体(drivers/hdf_core/framework/model/display/driver/hdf_disp.h)
```c++ ```c++
struct PanelInfo { struct PanelInfo {
...@@ -225,7 +227,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony ...@@ -225,7 +227,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony
}; };
``` ```
- 初始化LCD屏 - 初始化LCD屏(drivers/hdf_core/framework/model/display/driver/panel/mipi_icn9700.c)
```c++ ```c++
static uint8_t g_payLoad0[] = { 0xF0, 0x5A, 0x5A }; static uint8_t g_payLoad0[] = { 0xF0, 0x5A, 0x5A };
...@@ -257,7 +259,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony ...@@ -257,7 +259,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony
static DevHandle g_pwmHandle = NULL; static DevHandle g_pwmHandle = NULL;
``` ```
- 设置Reset Pin脚状态 - 设置Reset Pin脚状态(/drivers_hdf_core/framework/model/display/driver/panel/mipi_icn9700.c)
```c++ ```c++
static int32_t LcdResetOn(void) static int32_t LcdResetOn(void)
...@@ -279,7 +281,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony ...@@ -279,7 +281,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony
} }
``` ```
- 器件驱动入口函数 - 器件驱动入口函数(/drivers_hdf_core/framework/model/display/driver/panel/mipi_icn9700.c)
```c++ ```c++
int32_t SampleEntryInit(struct HdfDeviceObject *object) int32_t SampleEntryInit(struct HdfDeviceObject *object)
......
...@@ -13,111 +13,156 @@ OpenHarmony为开发者提供了两种Docker环境,以帮助开发者快速完 ...@@ -13,111 +13,156 @@ OpenHarmony为开发者提供了两种Docker环境,以帮助开发者快速完
| 系统类型 | 运行平台 | Docker镜像仓库 | 标签 | | 系统类型 | 运行平台 | Docker镜像仓库 | 标签 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| 轻量和小型系统/标准系统(独立Docker环境) | Ubuntu/Windows | swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker | 1.0.0 | | 标准系统(独立Docker环境) | Ubuntu/Windows | swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_standard | 3.2 |
| 小型系统(独立Docker环境) | Ubuntu/Windows | swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_small | 3.2 |
| 轻量系统(独立Docker环境) | Ubuntu/Windows | swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_mini | 3.2 |
| 轻量和小型系统(HPM Docker环境) | Ubuntu/Windows | swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker | 0.0.3 | | 轻量和小型系统(HPM Docker环境) | Ubuntu/Windows | swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker | 0.0.3 |
## 环境准备 ## 环境准备
在使用docker环境前需要先完成以下操作 在使用Docker环境前,需要准备源码和一些基本工具,以Ubuntu为例,您需要执行以下步骤
1. 安装Docker,Docker安装请参考[官方指导](https://docs.docker.com/engine/install/) 1. 安装Docker
- 在Ubuntu中,可以使用下面的命令来安装Docker:
```
sudo apt install docker.io
```
- 其他系统的Docker安装请参考[Docker指导](https://docs.docker.com/engine/install/)
2. 获取OpenHarmony源码
2. 获取OpenHarmony源码,请参考[获取源码](sourcecode-acquire.md) 请参考[获取源码](sourcecode-acquire.md)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br> > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> HPM Docker环境无需单独获取源码。 > HPM Docker环境无需单独获取源码。
3. 请使用具备root权限的用户,或已被授予docker使用权限的用户进行后续操作。 3. 获取使用权限
为了能够使用Docker,请使用具备root权限的用户,或已被授予Docker使用权限的用户进行后续操作。在Ubuntu系统中,通常可以通过在命令前加sudo来获取root权限。在Windows系统中,您可能需要在管理员模式下运行cmd或PowerShell。
## 独立Docker环境 ## 独立Docker环境
OpenHarmony的Docker镜像托管在HuaweiCloud SWR上。开发者可以通过该镜像在很大程度上简化编译前的环境配置。下文将介绍具体使用步骤。 Docker镜像是包含了运行环境和应用程序的轻量级、可执行的软件包,OpenHarmony的Docker镜像托管在HuaweiCloud SWR上。开发者可以通过该镜像在很大程度上简化编译前的环境配置。这一部分将引导您如何在Docker环境中配置和使用OpenHarmony,下文将介绍具体使用步骤。
### 搭建Docker环境(轻量系统和小型系统) ### 搭建Docker环境(轻量系统和小型系统)
1. 获取Docker镜像。 1. 获取Docker镜像
获取小型系统镜像的命令为:
``` ```
docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0 docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_small:3.2
```
获取轻量系统镜像的命令为:
```
docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_mini:3.2
``` ```
2. 进入源码根目录执行如下命令,从而进入Docker构建环境。 2. 进入Docker构建环境
ubuntu下执行:
在获取了镜像之后,您需要创建一个新的Docker容器,并进入该容器中。进入OpenHarmony源码根目录执行如下命令,从而进入Docker构建环境。
- Ubuntu系统
``` ```
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0 # 进入小型系统Docker构建环境
``` docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_small:3.2
windows下执行(假设源码目录为D:\OpenHarmony): # 进入轻量系统Docker构建环境
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_mini:3.2
```
- Windows系统(假设源码目录为`D:\OpenHarmony`):
``` ```
docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0 # 进入小型系统Docker构建环境
docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_small:3.2
# 进入轻量系统Docker构建环境
docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_mini:3.2
``` ```
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> `docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_small:3.2` 这个命令的含义是,创建并运行一个新的OpenHarmony的Docker容器,这个容器运行在交互模式下,并且将当前目录映射到容器的/home/openharmony目录。
### 编译源码(轻量系统和小型系统) ### 编译源码(轻量系统和小型系统)
通过如下编译脚本启动轻量系统类设备(参考内存≥128KiB)和小型系统类设备(参考内存≥1MiB)的编译。下文以Hi3516平台为例说明具体编译步骤。 1. 启动编译脚本
执行`docker run`命令进入Docker容器后(此时位于`/home/openharmony`路径下),您可以通过如下编译脚本启动轻量系统类设备(参考内存≥128KiB)和小型系统类设备(参考内存≥1MiB)的编译。
```
python3 build.py -p {product_name}@{company}
```
其中,`{product_name}`为当前版本支持的平台,`{company}``{product_name}`对应的公司名。
设置编译路径,选择当前路径。 举个例子,如果您要编译的产品为`hisilicon`下的`ipcamera_hispark_taurus`,您可以输入以下命令来启动编译:
``` ```
hb set python3 build.py -p ipcamera_hispark_taurus@hisilicon
. ```
```
**图1** 设置编译界面 同样,如果您要编译的产品是`ohemu`下的`qemu_small_system_demo`,那么您可以输入以下命令来启动编译:
![zh-cn_image_0000001153508656](figures/zh-cn_image_0000001153508656.png) ```
python3 build.py -p qemu_small_system_demo@ohemu
```
2. 查看编译结果
在编译结束后,编译所生成的文件都会被存放在`out/{device_name}/`目录下,结果镜像输出在`out/{device_name}/packages/phone/images/`目录下。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br> > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> 当前开发板平台和编译界面的对应关系如下: > 如需退出Docker,执行`exit`命令即可。这个命令会停止当前的Docker容器,并返回到您的操作系统。
>
> - Hi3861:wifiiot_hispark_pegasus\@hisilicon
>
> - Hi3516:ipcamera_hispark_taurus\@hisilicon
### 搭建Docker环境(标准系统)
1. 选择ipcamera_hispark_taurus\@hisilicon并回车。 1. 获取Docker镜像
2. 执行编译。 在搭建标准系统的Docker环境前,我们也需要先获取对应的Docker镜像。具体的命令如下:
``` ```
hb build -f docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_standard:3.2
``` ```
3. 查看编译结果。 2. 进入Docker构建环境
编译结果文件生成在out/hispark_taurus/ipcamera_hispark_taurus目录下。
### 搭建Docker环境(标准系统) 与之前的步骤相同,我们需要创建一个新的Docker容器,并进入该容器中。进入openharmony源码根目录执行如下命令,从而进入Docker构建环境。
1. 获取Docker镜像。 - Ubuntu系统
``` ```
docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0 docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_standard:3.2
``` ```
2. 进入源码根目录执行如下命令,从而进入Docker构建环境。 - Windows系统(假设源码目录为`D:\OpenHarmony`
``` ```
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0 docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_standard:3.2
``` ```
### 编译源码(标准系统) ### 编译源码(标准系统)
通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。 1. 启动编译脚本
执行`docker run`命令进入Docker容器后(此时位于`/home/openharmony`路径下),您可以通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。
``` ```
./build.sh --product-name {product_name} --ccache ./build.sh --product-name {product_name} --ccache
``` ```
{product_name}为当前版本支持的平台。比如:hispark_taurus_standard和rk3568等。 `{product_name}`为当前版本支持的平台。例如,您要编译的产品是`rk3568`,那么您可以输入以下命令来启动编译:
编译所生成的文件都归档在out/{device_name}/目录下,结果镜像输出在 out/{device_name}/packages/phone/images/ 目录下。 ```
./build.sh --product-name rk3568 --ccache
```
2. 查看编译结果\
编译所生成的文件都归档在`out/{device_name}/`目录下,结果镜像输出在`out/{device_name}/packages/phone/images/`目录下。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br> > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> 如需退出Docker,执行exit命令即可 > 如需退出Docker,执行`exit`命令即可。这个命令会停止当前的Docker容器,并返回到您的操作系统
## 基于HPM的Docker环境 ## 基于HPM的Docker环境
...@@ -127,13 +172,16 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件, ...@@ -127,13 +172,16 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件,
### 搭建Docker环境 ### 搭建Docker环境
1. 初始化安装模板。在任意工作目录中执行以下命令。 1. 初始化安装模板
在任意工作目录中执行以下命令
``` ```
hpm init -t @ohos/docker_dist hpm init -t @ohos/docker_dist
``` ```
2. 修改publishAs。 2. 修改publishAs
因为获取到的是模板类型的包,要把包的类型改为需要的类型。 在当前目录下打开bundle.json文件,把"publishAs"字段的值由"template"改为"distribution"。 因为获取到的是模板类型的包,要把包的类型改为需要的类型。 在当前目录下打开bundle.json文件,把"publishAs"字段的值由"template"改为"distribution"。
...@@ -141,10 +189,10 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件, ...@@ -141,10 +189,10 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件,
执行编译。自动安装docker只能在Ubuntu环境下执行,如果其他环境,需要用户自行安装docker,然后拉取镜像,执行编译。 执行编译。自动安装docker只能在Ubuntu环境下执行,如果其他环境,需要用户自行安装docker,然后拉取镜像,执行编译。
- **自动安装docker(Ubuntu环境)**<br> - 自动安装docker(Ubuntu环境)<br>
以下命令可以帮助用户自动安装docker, 拉取镜像,并且在容器中开始运行对应解决方案的拉取和编译。 以下命令可以帮助用户自动安装docker, 拉取镜像,并且在容器中开始运行对应解决方案的拉取和编译。
**方式一:** 方式一:
命令后接参数指定解决方案,格式如下: 命令后接参数指定解决方案,格式如下:
...@@ -155,7 +203,7 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件, ...@@ -155,7 +203,7 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件,
{product}为需编译的解决方案,如:\@ohos/hispark_taurus、\@ohos/hispark_aries、\@ohos/hispark_pegasus。 {product}为需编译的解决方案,如:\@ohos/hispark_taurus、\@ohos/hispark_aries、\@ohos/hispark_pegasus。
**方式二:** 方式二:
设置环境变量来选择解决方案,再执行编译命令。 设置环境变量来选择解决方案,再执行编译命令。
...@@ -180,7 +228,7 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件, ...@@ -180,7 +228,7 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件,
@ohos/hispark_taurus: distribution building completed. @ohos/hispark_taurus: distribution building completed.
``` ```
- **自行安装docker(非Ubuntu环境)**<br> - 自行安装docker(非Ubuntu环境)<br>
自行安装docker相关操作如下: 自行安装docker相关操作如下:
......
...@@ -139,7 +139,36 @@ component ...@@ -139,7 +139,36 @@ component
示例4:在部件的bundle.json中添加模块配置:test/examples/bundle.json。每个部件都有一个bundle.json配置文件,在部件的根目录下。示例见:[部件的bundle.json](subsys-build-component.md#部件配置规则) 示例4:在部件的bundle.json中添加模块配置:test/examples/bundle.json。每个部件都有一个bundle.json配置文件,在部件的根目录下。示例见:[部件的bundle.json](subsys-build-component.md#部件配置规则)
2. 将部件添加到产品配置中。 在产品的配置中添加部件,产品对应的配置文件://vendor/{product_company}/{product-name}/config.json。 2. 将部件添加到产品配置中。 在产品的配置中添加部件,产品对应的配置文件://vendor/{product_company}/{product-name}/config.json。下面以vendor/hisilicon/hispark_taurus_standard/config.json为例:
```shell
{
"product_name": "hispark_taurus_standard",
"device_company": "hisilicon",
"device_build_path": "device/board/hisilicon/hispark_taurus/linux",
"target_cpu": "arm",
"type": "standard",
"version": "3.0",
"board": "hispark_taurus",
"inherit": [ "productdefine/common/base/standard_system.json",
"productdefine/common/inherit/ipcamera.json"
],
"enable_ramdisk": true,
"subsystems": [
{
"subsystem": "subsystem_examples", # 部件所属子系统
"components": [
{
"component": "partA", # 部件名称
"features": [] # 部件对外的可配置特性列表
}
]
},
······
}
```
从中可以看出产品名称、芯片厂家等;inherit指出依赖的通用组件;subsystems指出通用组件以外的部件。
在产品配置文件中添加 "subsystem_examples:partA",表示该产品中会编译并打包partA到版本中。 在产品配置文件中添加 "subsystem_examples:partA",表示该产品中会编译并打包partA到版本中。
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
| Ability | 应用的重要组成部分,是应用所具备能力的抽象。Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。 | | Ability | 应用的重要组成部分,是应用所具备能力的抽象。Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。 |
| FA | Feature Ability,是FA模型的Ability框架下具有UI界面的Ability类型,用于与用户进行交互。Feature Ability唯一对应一种模板,即Page模板(Page Ability)。 | | FA | Feature Ability,是FA模型的Ability框架下具有UI界面的Ability类型,用于与用户进行交互。Feature Ability唯一对应一种模板,即Page模板(Page Ability)。 |
| PA | Particle Ability,是在FA模型的Ability框架下无界面的Ability,主要为Feature Ability提供服务与支持,例如作为后台服务提供计算能力,或作为数据仓库提供数据访问能力。Particle Ability有三种模板,分别为Service模板(Service Ability)、Data模板(Data Ability)、以及Form模板(Form Ability)。 | | PA | Particle Ability,是在FA模型的Ability框架下无界面的Ability,主要为Feature Ability提供服务与支持,例如作为后台服务提供计算能力,或作为数据仓库提供数据访问能力。Particle Ability有三种模板,分别为Service模板(Service Ability)、Data模板(Data Ability)、以及Form模板(Form Ability)。 |
| FA模型 | 两种Ability框架模型结构的其中一种。是Ability框架在API 8及更早版本采用FA模型。FA模型将Ability分为FA(Feature Ability)和PA(Particle Ability)两种类型,其中FA支持Page Ability模板,PA支持Service ability、Data ability、以及Form ability模板。详情可参考[FA模型综述](../../application-dev/ability/fa-brief.md)。 | | FA模型 | 两种Ability框架模型结构的其中一种。是Ability框架在API 8及更早版本采用FA模型。FA模型将Ability分为FA(Feature Ability)和PA(Particle Ability)两种类型,其中FA支持Page Ability模板,PA支持Service ability、Data ability、以及Form ability模板。详情可参考[FA模型综述](../../application-dev/ability-deprecated/fa-brief.md)。 |
| Stage模型 | 两种Ability框架模型结构的其中一种。从API 9开始支持。Stage模型将Ability分为Ability和ExtensionAbility两大类,其中ExtensionAbility又被扩展为ServiceExtensionAbility、FormExtensionAbility、DataShareExtensionAbility等等一系列ExtensionAbility。 | | Stage模型 | 两种Ability框架模型结构的其中一种。从API 9开始支持。Stage模型将Ability分为Ability和ExtensionAbility两大类,其中ExtensionAbility又被扩展为ServiceExtensionAbility、FormExtensionAbility、DataShareExtensionAbility等等一系列ExtensionAbility。 |
### 功能简介 ### 功能简介
......
# 分布式远程启动
## 概述
分布式任务调度模块,通过主从设备服务代理机制,在OpenHarmony操作系统上建立起分布式服务平台,支持主设备(搭载OpenHarmony的智慧屏设备)启动从设备(IP Camera、运动手表等小内存OpenHarmony设备)FA的能力。
以智慧屏节目开播提醒为例,智慧屏上在喜欢的节目菜单中,点击“开播后提醒我”按钮,等节目开播后,智慧屏会拉起运动手表上的节目开播提醒FA。通过该FA用户可以快速知道喜欢的节目已经开始,达到协同互助的作用。
## 基本概念
- FA
Feature Ability代表有界面的Ability,用于与用户进行交互。
- 远程启动
即跨设备启动FA,与本地启动FA相对应。
## 接口说明
智慧屏端分布式开放能力如下表,包含在AbilitySlice类中,具体的API接口详见OpenHarmony应用接入接口文档:
**表1** 分布式远程启动FA的API接口功能介绍
| 接口名 | 描述 |
| -------- | -------- |
| void&nbsp;startAbility(Want&nbsp;want) | 远程启动FA,Want参数命名以实际开发平台API为准。 |
**表2** 参数Want功能介绍
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| want | ohos.aafwk.content.Want | 当开发者需要调用该接口启动远程FA时,需要显式指定待启动FA的设备id、bundleName和abilityName。 |
## 约束与限制
- 支持主设备侧远程启动从设备侧FA,不支持从设备远程启动主设备FA。
- 远程启动前必须确保OpenHarmony设备间分布式组网成功(需要在同一网段内,可互相ping通),否则无法远程启动。
- 当前只支持拥有共同公钥信息的主从设备间FA(即主从设备的FA使用相同华为证书)的拉起。
## 开发步骤
智慧屏侧通过如下操作启动从设备侧FA,从设备侧FA默认已开发。
1. 打开DevEco Studio,完成智慧屏侧FA开发。
2. 获取目标在线从设备的设备ID。
```
// 引入设备选择头文件
import ohos.distributedschedule.interwork.DeviceInfo;
import ohos.distributedschedule.interwork.DeviceManager;
// 获取在线设备列表
List<DeviceInfo> deviceInfoListOnline = DeviceManager.getDmsDeviceList(DeviceInfo.FLAG_GET_ONLINE_DEVICE);
String remote_device_id;
if (deviceInfoListOnline.size() > 0)
{
remote_device_id = deviceInfoListOnline[0].GetDeviceId(); // 获取在线列表中第一台设备的设备ID
}
```
3. 构造want,首先使用ElementName类表明需要启动的远端设备ID,包名,Ability类名,传入want中,然后设置want中的分布式标志位Want.FLAG_ABILITYSLICE_MULTI_DEVICE表示需要远程启动。
```
// 引入相关头文件
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Want;
import ohos.bundle.ElementName;
// 启动远程设备FA
Want want = new Want(); // 封装启动远端FA的Want
// 使用步骤2中获取的设备ID,并指定FA信息
ElementName name = new ElementName(remote_device_id, "com.huawei.remote_package_name", "remote_class_name");
want.setElement(name); // 将待启动的FA信息添加到Want中
want.setFlags(Want.FLAG_ABILITYSLICE_MULTI_DEVICE); // 设置分布式标记,若不设置将无法使用分布式能力
startAbility(want); // 按照Want启动指定FA,Want参数命名以实际开发平台API为准
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册