diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md index 95504e593a1ae40a3f8853ca28f3067c71729315..c1f1ecbc6f84f69d9906615dee3a7c4625a08594 100644 --- a/en/application-dev/Readme-EN.md +++ b/en/application-dev/Readme-EN.md @@ -4,7 +4,7 @@ - About OpenHarmony - [OpenHarmony Project](../OpenHarmony-Overview.md) - [Glossary](../glossary.md) - - [OpenHarmony Release Notes](../release-notes/Readme.md) + - [Release Notes](../release-notes/Readme.md) - Quick Start - Getting Started - [Before You Start](quick-start/start-overview.md) @@ -15,7 +15,7 @@ - Application Package Fundamentals - [Application Package Overview](quick-start/application-package-overview.md) - 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) - Multi-HAP Mechanism - [Multi-HAP Design Objectives](quick-start/multi-hap-objective.md) @@ -36,9 +36,9 @@ - Application Configuration Files in FA Model - [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 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) - - [Resource Categories and Access](quick-start/resource-categories-and-access.md) + - [Resource Categories and Access](quick-start/resource-categories-and-access.md) - Learning ArkTS - [Getting Started with ArkTS](quick-start/arkts-get-started.md) - Basic Syntax @@ -47,19 +47,19 @@ - Custom Component - [Creating a Custom Component](quick-start/arkts-create-custom-components.md) - [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md) - - [\@Builder: Custom Builder Function](quick-start/arkts-builder.md) - - [\@BuilderParam: @Builder Function Reference](quick-start/arkts-builderparam.md) - - [\@Styles: Definition of Resusable Styles](quick-start/arkts-style.md) - - [\@Extend: Extension of Built-in Components](quick-start/arkts-extend.md) + - [\@Builder Decorator: Custom Builder Function](quick-start/arkts-builder.md) + - [\@BuilderParam Decorator: \@Builder Function Reference](quick-start/arkts-builderparam.md) + - [\@Styles Decorator: Definition of Resusable Styles](quick-start/arkts-style.md) + - [\@Extend Decorator: Extension of Built-in Components](quick-start/arkts-extend.md) - [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md) - State Management - [State Management Overview](quick-start/arkts-state-management-overview.md) - Component State Management - - [\@State: State Owned by Component](quick-start/arkts-state.md) - - [\@Prop: 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) - - [\@Provide and \@Consume: 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) + - [\@State Decorator: State Owned by Component](quick-start/arkts-state.md) + - [\@Prop Decorator: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md) + - [\@Link Decorator: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md) + - [\@Provide and \@Consume Decorators: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.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 Overview](quick-start/arkts-application-state-management-overview.md) - [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md) @@ -68,10 +68,10 @@ - [Environment: Device Environment Query](quick-start/arkts-environment.md) - Other State Management Features - [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) - 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) - [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md) - [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md) @@ -96,7 +96,7 @@ - [DFX](dfx/Readme-EN.md) - [Internationalization](internationalization/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) - Tools - [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md) @@ -109,11 +109,11 @@ - [SystemCapability List](reference/syscap-list.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) - - [JS Service Widget UI Components](reference/js-service-widget-ui/Readme-EN.md) - - APIs - - [ArkTS and JS APIs](reference/apis/Readme-EN.md) + - [JavaScript Service Widget UI Component Reference](reference/js-service-widget-ui/Readme-EN.md) + - API Reference + - [ArkTS and JavaScript APIs](reference/apis/Readme-EN.md) - [Error Codes](reference/errorcodes/Readme-EN.md) - - Native APIs + - Native API Reference - [Native APIs](reference/native-apis/Readme-EN.md) - [Standard Libraries](reference/native-lib/third_party_libc/musl.md) - [Node_API](reference/native-lib/third_party_napi/napi.md) diff --git a/en/application-dev/application-dev-guide.md b/en/application-dev/application-dev-guide.md index ad34cdd099a470dd7731cc0c3c086125044261b7..b668fd52c586df61ba93e62b39b0447dbec8ca53 100644 --- a/en/application-dev/application-dev-guide.md +++ b/en/application-dev/application-dev-guide.md @@ -10,7 +10,7 @@ The documents are carefully organized as follows: ## 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. @@ -40,12 +40,12 @@ Then, equip yourself for developing the key features, with the following guideli - [Data Management](database/data-mgmt-overview.md) - [File Management](file-management/file-management-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) - [DFX](dfx/hiappevent-guidelines.md) - [Internationalization](internationalization/international-overview.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) ## Tools @@ -63,11 +63,12 @@ API references encompass all components and APIs available in OpenHarmony, helpi 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 (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) -- [JS Service Widget UI Components](reference/js-service-widget-ui/js-service-widget-file.md) -- [JS and TS APIs](reference/apis/development-intro.md) -- Native APIs - - [Standard Library](reference/native-lib/third_party_libc/musl.md) +- [JavaScript Service Widget UI Component Reference](reference/js-service-widget-ui/js-service-widget-file.md) +- Native API Reference + - [Native APIs](reference/native-apis/_o_h___native_x_component.md) + - [Standard Libraries](reference/native-lib/third_party_libc/musl.md) - [Node_API](reference/native-lib/third_party_napi/napi.md) diff --git a/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md b/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md index a55cb9cd17cda67cc2989e5916db19c5cf36cc47..3fb83498972a425ef11821c3292a74bbdb81016d 100644 --- a/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md +++ b/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md @@ -1,12 +1,12 @@ # 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 [\](../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 @Entry @Component -struct Card { +struct WidgetCard { private canvasWidth: number = 0; private canvasHeight: number = 0; // Initialize CanvasRenderingContext2D and RenderingContextSettings. @@ -26,9 +26,9 @@ struct Card { this.canvasWidth = this.context.width; this.canvasHeight = this.context.height; // 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); - // Draw a red circle in the center of the canvas. + // Draw a circle in the center of the canvas. this.context.beginPath(); let radius = this.context.width / 3; let circleX = this.context.width / 2; @@ -36,35 +36,48 @@ struct Card { this.context.moveTo(circleX - radius, circleY); this.context.arc(circleX, circleY, radius, 2 * Math.PI, 0, true); this.context.closePath(); - this.context.fillStyle = 'red'; + this.context.fillStyle = '#5A5FFF'; this.context.fill(); // Draw the left eye of the smiling face. - let leftR = radius / 4; - let leftX = circleX - (radius / 2); - let leftY = circleY - (radius / 3.5); + let leftR = radius / 13; + let leftX = circleX - (radius / 2.3); + let leftY = circleY - (radius / 4.5); this.context.beginPath(); - this.context.arc(leftX, leftY, leftR, 0, Math.PI, true); - this.context.strokeStyle = '#ffff00'; - this.context.lineWidth = 10; + this.context.arc(leftX, leftY, leftR, 0, 2 * Math.PI, true); + this.context.strokeStyle = '#FFFFFF'; + this.context.lineWidth = 15; this.context.stroke(); // Draw the right eye of the smiling face. - let rightR = radius / 4; - let rightX = circleX + (radius / 2); - let rightY = circleY - (radius / 3.5); + let rightR = radius / 13; + let rightX = circleX + (radius / 2.3); + let rightY = circleY - (radius / 4.5); this.context.beginPath(); - this.context.arc(rightX, rightY, rightR, 0, Math.PI, true); - this.context.strokeStyle = '#ffff00'; - this.context.lineWidth = 10; + this.context.arc(rightX, rightY, rightR, 0, 2 * Math.PI, true); + this.context.strokeStyle = '#FFFFFF'; + 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(); // Draw the mouth of the smiling face. - let mouthR = radius / 2.5; + let mouthR = radius / 2; let mouthX = circleX; - let mouthY = circleY + (radius / 3); + let mouthY = circleY + 10; this.context.beginPath(); - this.context.arc(mouthX, mouthY, mouthR, Math.PI, 0, true); - this.context.strokeStyle = '#ffff00'; - this.context.lineWidth = 10; + this.context.arc(mouthX, mouthY, mouthR, Math.PI / 1.4, Math.PI / 3.4, true); + this.context.strokeStyle = '#FFFFFF'; + this.context.lineWidth = 15; this.context.stroke(); + this.context.closePath(); }) } }.height('100%').width('100%') @@ -74,4 +87,4 @@ struct Card { The figure below shows the effect. -![WidgetCanvasDemo](figures/WidgetCanvasDemo.png) \ No newline at end of file +![WidgetCanvasDemo](figures/WidgetCanvasDemo.jpeg) \ No newline at end of file diff --git a/en/application-dev/application-models/common-event-static-subscription.md b/en/application-dev/application-models/common-event-static-subscription.md index 86a3b593d63e49c4b3bd8f66f49b3e39d156d535..465fc236129d4c78967e6122c318132933043fb6 100644 --- a/en/application-dev/application-models/common-event-static-subscription.md +++ b/en/application-dev/application-models/common-event-static-subscription.md @@ -2,9 +2,7 @@ ## 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. - -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. +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. 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 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 import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility' @@ -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. - **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. - - **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. - > **NOTE** - > - > The **install_list_permissions.json** file is available only for preinstalled applications. - ```json [ ... { - "bundleName": "com.example.myapplication", // Bundle name of the application. - "app_signature": ["****"], // Fingerprint information of the application. - "allowCommonEvent": ["usual.event.A", "usual.event.B"], // Type of common event that can be started by static broadcast. - ] + "bundleName": "com.example.myapplication", // Bundle name. + "app_signature": ["****"], // Fingerprint information. + "allowCommonEvent": ["usual.event.A", "usual.event.B"] // Type of common event that can be started by static broadcast. } ] ``` + + > **NOTE** + > + > The **install_list_capability.json** file is available only for preinstalled applications. - \ No newline at end of file diff --git a/en/application-dev/application-models/figures/WidgetCanvasDemo.jpeg b/en/application-dev/application-models/figures/WidgetCanvasDemo.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..3961eba1947c74229e43af53d1ad525af414028f Binary files /dev/null and b/en/application-dev/application-models/figures/WidgetCanvasDemo.jpeg differ diff --git a/en/application-dev/application-models/figures/WidgetCanvasDemo.png b/en/application-dev/application-models/figures/WidgetCanvasDemo.png deleted file mode 100644 index c09c82dd88cf002020990b5b8327701c445eeaaf..0000000000000000000000000000000000000000 Binary files a/en/application-dev/application-models/figures/WidgetCanvasDemo.png and /dev/null differ diff --git a/en/application-dev/application-models/uiability-data-sync-with-ui.md b/en/application-dev/application-models/uiability-data-sync-with-ui.md index 6998001c763a464e51f8cef4a0c64aec6f1db5e8..8b008d0dbdd64029fd0e12ce179936579dbdd24e 100644 --- a/en/application-dev/application-models/uiability-data-sync-with-ui.md +++ b/en/application-dev/application-models/uiability-data-sync-with-ui.md @@ -1,18 +1,18 @@ -# 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 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 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 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 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**. @@ -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 import common from '@ohos.app.ability.common'; @@ -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. } - // Page display. + // UI page display. 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 [] @@ -77,7 +77,7 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub** [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 // context is the AbilityContext of the UIAbility instance. @@ -87,7 +87,7 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub** ## 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 ![globalThis1](figures/globalThis1.png) @@ -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. -- [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) -- [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) -### 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 import UIAbility from '@ohos.app.ability.UIAbility'; @@ -119,19 +119,19 @@ 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 let entryAbilityWant; - + @Entry @Component struct Index { aboutToAppear() { entryAbilityWant = globalThis.entryAbilityWant; } - - // Page display. + + // UI page display. build() { ... } @@ -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. -1. UIAbilityA stores a string and binds it to globalThis. +1. Save data in UIAbilityA and bind it to **globalThis**. ```ts import UIAbility from '@ohos.app.ability.UIAbility' @@ -160,7 +160,7 @@ To implement data synchronization between two UIAbility components in the same a ```ts import UIAbility from '@ohos.app.ability.UIAbility' - + export default class UIAbilityB extends UIAbility { onCreate(want, launch) { // UIAbilityB reads name from globalThis and outputs it. @@ -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. -1. UIAbilityA stores a string and binds it to globalThis. +1. Save data in UIAbilityA and bind it to **globalThis**. ```ts import UIAbility from '@ohos.app.ability.UIAbility' @@ -193,7 +193,7 @@ To implement data synchronization between the UIAbility and ExtensionAbility com ```ts import Extension from '@ohos.app.ability.ServiceExtensionAbility' - + export default class ServiceExtAbility extends Extension { onCreate(want) { / / ServiceExtAbility reads name from globalThis and outputs it. @@ -206,18 +206,20 @@ To implement data synchronization between the UIAbility and ExtensionAbility com ### Precautions for Using globalThis -**Figure 2** Precautions for globalThis +**Figure 2** Precautions for using globalThis ![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. +- **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. -- 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. -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 import UIAbility from '@ohos.app.ability.UIAbility' @@ -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 @Entry @@ -239,14 +241,14 @@ The following provides an example to describe the object overwritten problem in onPageShow() { let ctx = globalThis.context; // Obtain the context from globalThis and use it. } - // Page display. + // UI page display. 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 import UIAbility from '@ohos.app.ability.UIAbility' @@ -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 @Entry @@ -269,7 +271,7 @@ The following provides an example to describe the object overwritten problem in onPageShow() { let ctx = globalThis.context; // Obtain the context from globalThis and use it. } - // Page display. + // UI page display. build() { ... } @@ -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 @Entry @@ -298,7 +300,7 @@ The following provides an example to describe the object overwritten problem in onPageShow() { let ctx = globalThis.context; // The context in globalThis is the context of UIAbilityB. } - // Page display. + // UI page display. build() { ... } @@ -307,4 +309,4 @@ The following provides an example to describe the object overwritten problem in ## 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). diff --git a/en/application-dev/file-management/app-sandbox-directory.md b/en/application-dev/file-management/app-sandbox-directory.md index b94f8ed79eee6be3cf42946573dd9635b32eaa3c..1f012ece997fa09706d01353cbf91dfc80bb945f 100644 --- a/en/application-dev/file-management/app-sandbox-directory.md +++ b/en/application-dev/file-management/app-sandbox-directory.md @@ -10,8 +10,7 @@ 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. -**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 Directory and Application Sandbox Path @@ -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). -- 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 File Directory and Application File Path @@ -36,8 +34,7 @@ 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. -**Figure 3** Application file directory structure - +**Figure 3** Application file directory structure ![Application file directory structure](figures/application-file-directory-structure.png) 1. Level 1 directory **data/**: indicates the application file directory. @@ -65,16 +62,16 @@ The following figure shows the application file directories. The path of a file **Table 1** Application file paths - | 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.
This directory is cleared when the application is uninstalled.
Do not access resource files by concatenating paths. Use [@ohos.resourceManager] 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/**.
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.
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.
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.
This directory is cleared when the application is uninstalled.| - | cache | cacheDir | Application cache file directory| Directory for caching the downloaded files of the application or saving the cache files regenerated on the device.
This directory is automatically cleared when the size of the **cache** directory reaches the quota or the system storage space reaches a certain threshold. The user can also clear this directory by using a system space management application.
The application needs to check whether the file still exists and determine whether to cache the file again.| - | preferences | preferencesDir | Preferences file directory| Directory for saving common application configuration and user preference data managed by using database APIs.
This directory is cleared when the application is uninstalled. For details, see [Persisting Preferences Data](../database/data-persistence-by-preferences.md).| - | temp | tempDir | Temporary file directory| Directory for saving the files generated and required during the application's runtime on the device.
This directory is cleared when the application exits.| + | bundle | bundleCodeDir | Installation file directory| Directory for saving the HAPs of the application after an application is installed.
This directory is cleared when the application is uninstalled.
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/**.
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.
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.
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.
This directory is cleared when the application is uninstalled.| + | cache | cacheDir | Application cache file directory| Directory for caching the downloaded files of the application or saving the cache files regenerated on the device.
This directory is automatically cleared when the size of the **cache** directory reaches the quota or the system storage space reaches a certain threshold. The user can also clear this directory by using a system space management application.
The application needs to check whether the file still exists and determine whether to cache the file again.| + | preferences | preferencesDir | Preferences file directory| Directory for saving common application configuration and user preference data managed by using database APIs.
This directory is cleared when the application is uninstalled. For details, see [Persisting Preferences Data](../database/data-persistence-by-preferences.md).| + | temp | tempDir | Temporary file directory| Directory for saving the files generated and required during the application's runtime on the device.
This directory is cleared when the application exits.| The application file paths are used in the following scenarios: diff --git a/en/application-dev/quick-start/arkts-appstorage.md b/en/application-dev/quick-start/arkts-appstorage.md index 9e9fa59b996446f73e68ecc5a6155681f96b9d7f..e64bd6c487bbcbd01c6e44b1058fc5474e783bb8 100644 --- a/en/application-dev/quick-start/arkts-appstorage.md +++ b/en/application-dev/quick-start/arkts-appstorage.md @@ -12,7 +12,7 @@ This topic describes only the AppStorage application scenarios and related decor ## 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. @@ -21,7 +21,7 @@ Selected state attributes of AppStorage can be synced with different data source ## \@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.) @@ -44,7 +44,7 @@ By decorating a variable with \@StorageProp(key), a one-way data synchronization | Transfer/Access | Description | | ---------- | ---------------------------------------- | | 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. | @@ -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 = [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 = [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 @@ -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 **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). + diff --git a/en/application-dev/quick-start/arkts-localstorage.md b/en/application-dev/quick-start/arkts-localstorage.md index 3c3e4853f8aac66be1afc1ef47d295ecc7528830..98a23a065448631fe67434708fad58b149d4e119 100644 --- a/en/application-dev/quick-start/arkts-localstorage.md +++ b/en/application-dev/quick-start/arkts-localstorage.md @@ -9,7 +9,7 @@ This topic describes only the LocalStorage application scenarios and related dec > **NOTE** > -> This module is supported since API version 9. +> LocalStorage is supported since API version 9. ## Overview @@ -292,7 +292,7 @@ struct CompA { .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()}`) } } @@ -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. -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. @@ -379,7 +379,7 @@ Changes in the **Child** custom component: ### 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 diff --git a/en/application-dev/quick-start/arkts-observed-and-objectlink.md b/en/application-dev/quick-start/arkts-observed-and-objectlink.md index 808e522540be970004aab0a2bcd2009af3916df0..d55b9a96d1abc93b9c7d941ef6112bce96b95f0c 100644 --- a/en/application-dev/quick-start/arkts-observed-and-objectlink.md +++ b/en/application-dev/quick-start/arkts-observed-and-objectlink.md @@ -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. -- 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. @@ -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.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**: -- 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. @@ -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. 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 diff --git a/en/application-dev/quick-start/arkts-persiststorage.md b/en/application-dev/quick-start/arkts-persiststorage.md index cff8f9aa3bc83f9e1f34be3c50652c925ecd0437..354589627e4921c6da1662c094e67cf499a6957c 100644 --- a/en/application-dev/quick-start/arkts-persiststorage.md +++ b/en/application-dev/quick-start/arkts-persiststorage.md @@ -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. +PersistentStorage can be called to persist data only when used in UI pages. ## Application Scenarios diff --git a/en/application-dev/quick-start/arkts-watch.md b/en/application-dev/quick-start/arkts-watch.md index 6a566f0a6ba720ad967bb54c86649edb6e817f77..08ae0631beda39cd2d511fd05f4d800952c26de1 100644 --- a/en/application-dev/quick-start/arkts-watch.md +++ b/en/application-dev/quick-start/arkts-watch.md @@ -1,4 +1,4 @@ -# \@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. @@ -27,7 +27,7 @@ An application can request to be notified whenever the value of the \@Watch deco | Type | Description | | ---------------------------------------- | ---------------------------------------- | -| (changedPropertyName? : string) => void | This function is a member function of the custom component. **changedPropertyName** indicates the name of the watched attribute.
It is useful when you use the same function as a callback to several watched attributes.
It takes the attribute name as a string input parameter and returns nothing.| +| (changedPropertyName? : string) => void | This function is a member function of the custom component. **changedPropertyName** indicates the name of the watched attribute.
It is useful when you use the same function as a callback to several watched attributes.
It takes the attribute name as a string input parameter and returns nothing.| ## Observed Changes and Behavior @@ -131,7 +131,7 @@ The processing procedure is as follows: ### \@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 diff --git a/en/application-dev/quick-start/deviceconfig-structure.md b/en/application-dev/quick-start/deviceconfig-structure.md index bc15571c43fdb5c0be860098cd4ad4c799a6ea16..848d55f1adc12859b9ad6c98c078ba8532ae2c84 100644 --- a/en/application-dev/quick-start/deviceconfig-structure.md +++ b/en/application-dev/quick-start/deviceconfig-structure.md @@ -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)| | 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**)| -| 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)| ## Internal Structure of the network Attribute diff --git a/en/application-dev/quick-start/module-configuration-file.md b/en/application-dev/quick-start/module-configuration-file.md index 017ea8d1237702b5b959069dff14b363dc1cdf53..ccb6ea94b1c2aa34d8b8486b5490abccd93dd74a 100644 --- a/en/application-dev/quick-start/module-configuration-file.md +++ b/en/application-dev/quick-start/module-configuration-file.md @@ -219,7 +219,7 @@ The **metadata** tag represents the custom metadata of the HAP file. The tag val ## 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 diff --git a/en/application-dev/reference/Readme-EN.md b/en/application-dev/reference/Readme-EN.md index be2f3f5d46c2e566d8c40bac7b5257ad9a9ba334..03055bf9196bf77de08d2bfcd364e0c9bf9c3e3e 100644 --- a/en/application-dev/reference/Readme-EN.md +++ b/en/application-dev/reference/Readme-EN.md @@ -1,10 +1,13 @@ # Development References + +- [ArkTS API Reference](apis/Readme-EN.md) - [SystemCapability](syscap.md) - [SystemCapability List](syscap-list.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) -- [JS Service Widget UI Component Reference](js-service-widget-ui/Readme-EN.md) -- [API Reference (ArkTS and JS APIs)](apis/Readme-EN.md) +- [Component Reference (JavaScript-compatible Web-like Development Paradigm - ArkUI.Full)](arkui-js/Readme-EN.md) +- [Component Reference (JavaScript-compatible Web-like Development Paradigm - ArkUI.Lite)](arkui-js-lite/Readme-EN.md) +- [JavaScript Service Widget UI Component Reference](js-service-widget-ui/Readme-EN.md) - [Error Codes](errorcodes/Readme-EN.md) -- API Reference (Native APIs) - - [Standard Libraries Supported by Native APIs](native-lib/Readme-EN.md) +- Native API Reference + - [OpenHarmony Native APIs](native-apis/Readme-EN.md) + - [Standard Libraries Supported by Native APIs](native-lib/Readme-EN.md) diff --git a/en/application-dev/reference/apis/js-apis-accessibility.md b/en/application-dev/reference/apis/js-apis-accessibility.md index edd869ff076cf3b87920505470fb228759ce5980..7d0551d188fd809e7ee770efc9bb9421e8562de9 100644 --- a/en/application-dev/reference/apis/js-apis-accessibility.md +++ b/en/application-dev/reference/apis/js-apis-accessibility.md @@ -1,4 +1,4 @@ -# @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. @@ -134,14 +134,14 @@ Describes the style of captions. **System capability**: SystemCapability.BarrierFree.Accessibility.Hearing -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | Yes| No| Font family of captions.| -| fontScale | number | Yes| No| Font scale of captions.| -| fontColor | number \| string | Yes| No| Font color of captions.| -| fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | Yes| No| Font edge type of captions.| -| backgroundColor | number \| string | Yes| No| Background color of captions.| -| windowColor | number \| string | Yes| No| Window color of captions.| +| Name | Type | Readable | Writable | Description | +| --------------- | ---------------------------------------- | ---- | ---- | ----------- | +| fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | Yes | No | Font family 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. For example, red corresponds to #FF0000. | +| fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | Yes | No | Font edge type 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. For example, red corresponds to #FF0000. | ## CaptionsManager8+ diff --git a/en/application-dev/reference/apis/js-apis-animator.md b/en/application-dev/reference/apis/js-apis-animator.md index 4ee805e01e41f3b39a7660d56449a0c082a71131..5134a0f51745c9870b6992cc91fb865830b21bdc 100644 --- a/en/application-dev/reference/apis/js-apis-animator.md +++ b/en/application-dev/reference/apis/js-apis-animator.md @@ -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. > -> 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 @@ -37,17 +37,19 @@ Creates an **Animator** object. **Example** ```js - let options = { - duration: 1500, - easing: "friction", - delay: 0, - fill: "forwards", - direction: "normal", - iterations: 3, - begin: 200.0, - end: 400.0 - }; - animator.create(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, + easing: "friction", + delay: 0, + fill: "forwards", + direction: "normal", + iterations: 3, + begin: 200.0, + end: 400.0 +}; +animator.create(options); ``` ## AnimatorResult @@ -80,7 +82,7 @@ For details about the error codes, see [Animator Error Codes](../errorcodes/erro **Example** ```js -let options = { +let options: AnimatorOptions = { // The explicit type AnimatorOptions does not need to be emphasized in the xxx.js file. duration: 1500, easing: "friction", delay: 0, @@ -513,7 +515,7 @@ This API is deprecated since API version 9. You are advised to use [create9 **Example** ```js -let options = { +let options: AnimatorOptions = { // The explicit type AnimatorOptions does not need to be emphasized in the xxx.js file. duration: 1500, easing: "friction", delay: 0, diff --git a/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md index 822b524809931cae4853d069606c77b1a1e5af26..672034fb82d29a4ec7619ccdf8a2249e218c6b26 100644 --- a/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md @@ -1,4 +1,4 @@ -# @ohos.application.DataShareExtensionAbility (DataShare Extension Ability) +# @ohos.application.DataShareExtensionAbility (DataShare ExtensionAbility) The **DataShareExtensionAbility** module provides data share services based on the ExtensionAbility. @@ -41,7 +41,7 @@ Example: **System capability**: SystemCapability.DistributedDataManager.DataShare.Provider -| Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | | context | [ExtensionContext](js-apis-inner-application-extensionContext.md) | Yes| No|Context of the DataShare Extension ability.| @@ -57,7 +57,7 @@ Called by the server to initialize service logic when the DataShare client conne | 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<void> | Yes| Callback that returns no value.| **Example** @@ -78,10 +78,10 @@ export default class DataShareExtAbility extends DataShareExtensionAbility { name: DB_NAME, securityLevel: rdb.SecurityLevel.S1 }, function (err, data) { - console.log('getRdbStore done, data : ' + data); + console.info(`getRdbStore done, data : ${data}`); rdbStore = data; rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) { - console.log('executeSql done, error message : ' + err); + console.error(`executeSql done, error message : ${err}`); }); if (callback) { callback(); @@ -122,11 +122,11 @@ let rdbStore; export default class DataShareExtAbility extends DataShareExtensionAbility { insert(uri, valueBucket, callback) { if (valueBucket === null) { - console.info('invalid valueBuckets'); + console.error('invalid valueBuckets'); return; } rdbStore.insert(TBL_NAME, valueBucket, function (err, ret) { - console.info('callback ret:' + ret); + console.info(`callback ret: ${ret}`); if (callback !== undefined) { callback(err, ret); } @@ -256,7 +256,7 @@ export default class DataShareExtAbility extends DataShareExtensionAbility { } rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) { if (resultSet !== undefined) { - console.info('resultSet.rowCount: ' + resultSet.rowCount); + console.info(`resultSet.rowCount: ${resultSet.rowCount}`); } if (callback !== undefined) { callback(err, resultSet); @@ -297,14 +297,12 @@ let rdbStore; export default class DataShareExtAbility extends DataShareExtensionAbility { batchInsert(uri, valueBuckets, callback) { if (valueBuckets === null || valueBuckets.length === undefined) { - console.info('invalid valueBuckets'); + console.error('invalid valueBuckets'); return; } - let resultNum = valueBuckets.length; - valueBuckets.forEach(vb => { - rdbStore.insert(TBL_NAME, vb, function (err, ret) { + rdbStore.batchInsert(TBL_NAME, valueBuckets, function (err, ret) { if (callback !== undefined) { - callback(err, resultNum); + callback(err, ret); } }); }); @@ -333,7 +331,7 @@ Normalizes a URI. This API can be overridden as required. export default class DataShareExtAbility extends DataShareExtensionAbility { normalizeUri(uri, callback) { let err = {'code':0}; - let ret = 'normalize+' + uri; + let ret = `normalize: ${uri}`; callback(err, ret); } }; @@ -360,7 +358,7 @@ Denormalizes a URI. This API can be overridden as required. export default class DataShareExtAbility extends DataShareExtensionAbility { denormalizeUri(uri, callback) { let err = {'code':0}; - let ret = 'denormalize+' + uri; + let ret = `denormalize ${uri}`; callback(err, ret); } }; diff --git a/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md b/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md index 4cdef60fa628733e5be8cc6df783548b7b5bcd07..020d8c43c94ccb8313a7cde1fbad39048b11395b 100644 --- a/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md +++ b/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md @@ -27,7 +27,7 @@ let dataShareHelper; let uri = ("datashare:///com.samples.datasharetest.DataShare"); await dataShare.createDataShareHelper(this.context, uri, (err, data) => { if (err != undefined) { - console.info("createDataShareHelper fail, error message : " + err); + console.error("createDataShareHelper fail, error message : " + err); } else { console.info("createDataShareHelper end, data : " + data); dataShareHelper = data; @@ -39,10 +39,10 @@ let da = new dataSharePredicates.DataSharePredicates(); let resultSet; da.equalTo("name", "ZhangSan"); dataShareHelper.query(uri, da, columns).then((data) => { - console.log("query end, data : " + data); + console.info("query end, data : " + data); resultSet = data; }).catch((err) => { - console.log("query fail, error message : " + err); + console.error("query fail, error message : " + err); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-data-dataShare.md b/en/application-dev/reference/apis/js-apis-data-dataShare.md index be4f3d3022b51e7eada6f7736818f1f2b8ceeea0..98e04635bc793f003c0d944669d4097d9bd5ba2e 100644 --- a/en/application-dev/reference/apis/js-apis-data-dataShare.md +++ b/en/application-dev/reference/apis/js-apis-data-dataShare.md @@ -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 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 @@ -51,7 +49,7 @@ Creates a **DataShareHelper** instance. This API uses an asynchronous callback t | 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. | | callback | AsyncCallback<[DataShareHelper](#datasharehelper)> | 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"); let dataShareHelper; try { dataShare.createDataShareHelper(this.context, uri, (err, data) => { - if (err != undefined) { + if (err !== undefined) { console.error(`createDataShareHelper error: code: ${err.code}, message: ${err.message} `); return; } @@ -96,7 +94,7 @@ Creates a **DataShareHelper** instance. This API uses a promise to return the re | 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.| **Return value** @@ -262,7 +260,7 @@ const valueBucket = { } try { dataShareHelper.insert(uri, valueBucket).then((data) => { - console.log("insert succeed, data : " + data); + console.info("insert succeed, data : " + data); }). catch((err) => { console.error(`insert error: code: ${err.code}, message: ${err.message} `); }); @@ -298,7 +296,7 @@ let da = new dataSharePredicates.DataSharePredicates(); da.equalTo("name", "ZhangSan"); try { dataShareHelper.delete(uri, da, (err, data) => { - if (err != undefined) { + if (err !== undefined) { console.error(`delete error: code: ${err.code}, message: ${err.message} `); return; } @@ -341,7 +339,7 @@ let da = new dataSharePredicates.DataSharePredicates(); da.equalTo("name", "ZhangSan"); try { dataShareHelper.delete(uri, da).then((data) => { - console.log("delete succeed, data : " + data); + console.info("delete succeed, data : " + data); }). catch((err) => { console.error(`delete error: code: ${err.code}, message: ${err.message} `); }); @@ -379,11 +377,11 @@ let da = new dataSharePredicates.DataSharePredicates(); da.equalTo("name", "ZhangSan"); try { dataShareHelper.query(uri, da, columns, (err, data) => { - if (err != undefined) { + if (err !== undefined) { console.error(`query error: code: ${err.code}, message: ${err.message} `); return; } - console.log("query succeed, rowCount : " + data.rowCount); + console.info("query succeed, rowCount : " + data.rowCount); }); } catch (err) { console.error(`query error: code: ${err.code}, message: ${err.message} `); @@ -424,7 +422,7 @@ let da = new dataSharePredicates.DataSharePredicates(); da.equalTo("name", "ZhangSan"); try { dataShareHelper.query(uri, da, columns).then((data) => { - console.log("query succeed, rowCount : " + data.rowCount); + console.info("query succeed, rowCount : " + data.rowCount); }). catch((err) => { console.error(`query error: code: ${err.code}, message: ${err.message} `); }); @@ -467,11 +465,11 @@ const va = { } try { dataShareHelper.update(uri, da, va, (err, data) => { - if (err != undefined) { + if (err !== undefined) { console.error(`update error: code: ${err.code}, message: ${err.message} `); return; } - console.log("update succeed, data : " + data); + console.info("update succeed, data : " + data); }); } catch (err) { console.error(`update error: code: ${err.code}, message: ${err.message} `); @@ -517,7 +515,7 @@ const va = { } try { dataShareHelper.update(uri, da, va).then((data) => { - console.log("update succeed, data : " + data); + console.info("update succeed, data : " + data); }). catch((err) => { 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,}, {"name": "roe13", "age": 21, "salary": 20.5,}) try { dataShareHelper.batchInsert(uri, vbs, (err, data) => { - if (err != undefined) { + if (err !== undefined) { console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `); return; } - console.log("batchInsert succeed, data : " + data); + console.info("batchInsert succeed, data : " + data); }); } catch (err) { 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,}, {"name": "roe13", "age": 21, "salary": 20.5,}) try { dataShareHelper.batchInsert(uri, vbs).then((data) => { - console.log("batchInsert succeed, data : " + data); + console.info("batchInsert succeed, data : " + data); }). catch((err) => { 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 import UIAbility from '@ohos.app.ability.UIAbility' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.normalizeUri(uri, (err, data) => { - if (err != undefined) { - console.log("normalizeUri failed, error message : " + err); + if (err !== undefined) { + console.error("normalizeUri failed, error message : " + err); }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 import UIAbility from '@ohos.app.ability.UIAbility' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.normalizeUri(uri).then((data) => { - console.log("normalizeUri = " + data); + console.info("normalizeUri = " + data); }).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. import UIAbility from '@ohos.app.ability.UIAbility' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.denormalizeUri(uri, (err, data) => { - if (err != undefined) { - console.log("denormalizeUri failed, error message : " + err); + if (err !== undefined) { + console.error("denormalizeUri failed, error message : " + err); }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. import UIAbility from '@ohos.app.ability.UIAbility' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.denormalizeUri(uri).then((data) => { - console.log("denormalizeUri = " + data); + console.info("denormalizeUri = " + data); }).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 import UIAbility from '@ohos.app.ability.UIAbility' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.notifyChange(uri, () => { - console.log("***** notifyChange *****"); + console.info("***** notifyChange *****"); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-data-relationalStore.md b/en/application-dev/reference/apis/js-apis-data-relationalStore.md index 218572271420e03a9ff960879087a818751e4360..dabd05b0cd8fc4ba58c8e3a76b5e983b38accff7 100644 --- a/en/application-dev/reference/apis/js-apis-data-relationalStore.md +++ b/en/application-dev/reference/apis/js-apis-data-relationalStore.md @@ -38,11 +38,11 @@ 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). -| **ID**| **Error Message** | -| ------------ | ----------------------------------------------------------- | +| **ID**| **Error Message** | +| ------------ | ------------------------------------------------- | | 14800010 | Failed to open or delete database by invalid database path. | -| 14800011 | Failed to open database by database corrupted. | -| 14800000 | Inner error. | +| 14800011 | Failed open database, database corrupted. | +| 14800000 | The inner error is occurred. | **Example** @@ -122,11 +122,11 @@ 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). -| **ID**| **Error Message** | -| ------------ | ----------------------------------------------------------- | +| **ID**| **Error Message** | +| ------------ | ------------------------------------------------- | | 14800010 | Failed to open or delete database by invalid database path. | -| 14800011 | Failed to open database by database corrupted. | -| 14800000 | Inner error. | +| 14800011 | Failed open database, database corrupted. | +| 14800000 | The inner error is occurred. | **Example** @@ -198,10 +198,10 @@ 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). -| **ID**| **Error Message** | -| ------------ | ----------------------------------------------------------- | +| **ID**| **Error Message** | +| ------------ | ------------------------------------------------- | | 14800010 | Failed to open or delete database by invalid database path. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -265,10 +265,10 @@ 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). -| **ID**| **Error Message** | -| ------------ | ----------------------------------------------------------- | +| **ID**| **Error Message** | +| ------------ | ------------------------------------------------- | | 14800010 | Failed to open or delete database by invalid database path. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -378,22 +378,6 @@ Defines the subscription type. | Name | Value | Description | | --------------------- | ---- | ------------------ | | SUBSCRIBE_TYPE_REMOTE | 0 | Subscribe to remote data changes.| -| SUBSCRIBE_TYPE_CLOUD10+ | 1 | Subscribe to cloud data changes.| - -## ConflictResolution10+ - -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 @@ -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. -### Attributes10+ - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -| Name | Type | Mandatory| Description | -| ------------ | ----------- | ---- | -------------------------------- | -| version10+ | 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(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void @@ -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. | | callback | AsyncCallback<number> | 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 @@ -1317,49 +1275,6 @@ store.insert("EMPLOYEE", valueBucket, function (err, rowId) { }) ``` -### insert10+ - -insert(table: string, values: ValuesBucket, conflict: ConflictResolution, callback: AsyncCallback<number>):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<number> | 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 @@ -1388,8 +1303,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -1408,53 +1322,6 @@ promise.then((rowId) => { }) ``` -### insert10+ - -insert(table: string, values: ValuesBucket, conflict: ConflictResolution):Promise<number> - -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<number> | 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 @@ -1478,8 +1345,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -1540,8 +1406,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -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. | | callback | AsyncCallback<number> | 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. | +| 14800000 | The inner error is occurred. | **Example** @@ -1619,51 +1484,6 @@ store.update(valueBucket, predicates, function (err, rows) { }) ``` -### update10+ - -update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution, callback: AsyncCallback<number>):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<number> | 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 @@ -1692,8 +1512,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -1714,55 +1533,6 @@ promise.then(async (rows) => { }) ``` -### update10+ - -update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution):Promise<number> - -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<number> | 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 @@ -1791,8 +1561,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -1847,8 +1616,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -1891,8 +1659,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -1934,8 +1701,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -1976,8 +1742,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -2025,8 +1790,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -2062,9 +1826,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -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}`); return; } - console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); - // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. - 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(); + console.info(`ResultSet column names: ${resultSet.columnNames}`); + console.info(`ResultSet column count: ${resultSet.columnCount}`); }) ``` @@ -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. | | columns | Array<string> | 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** | Type | Description | | ------------------------------------------------------- | -------------------------------------------------- | | Promise<[ResultSet](#resultset)> | 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** ```js @@ -2126,17 +1881,8 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Rose"); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); promise.then((resultSet) => { - console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); - // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. - 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(); + console.info(`ResultSet column names: ${resultSet.columnNames}`); + console.info(`ResultSet column count: ${resultSet.columnCount}`); }).catch((err) => { console.error(`Query failed, code is ${err.code},message is ${err.message}`); }) @@ -2167,9 +1913,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -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}`); return; } - console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); - // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. - 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(); + console.info(`ResultSet column names: ${resultSet.columnNames}`); + console.info(`ResultSet column count: ${resultSet.columnCount}`); }) ``` @@ -2226,9 +1963,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -2238,17 +1975,8 @@ let predicates = new dataSharePredicates.DataSharePredicates(); predicates.equalTo("NAME", "Rose"); let promise = store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); promise.then((resultSet) => { - console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); - // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. - 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(); + console.info(`ResultSet column names: ${resultSet.columnNames}`); + console.info(`ResultSet column count: ${resultSet.columnCount}`); }).catch((err) => { console.error(`Query failed, code is ${err.code},message is ${err.message}`); }) @@ -2280,9 +2008,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -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}`); return; } - console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); - // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. - 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(); + console.info(`ResultSet column names: ${resultSet.columnNames}`); + console.info(`ResultSet column count: ${resultSet.columnCount}`); } ) ``` @@ -2355,9 +2074,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -2380,17 +2099,8 @@ let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); predicates.greaterThan("id", 0); let promise = store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); promise.then((resultSet) => { - console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); - // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. - 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(); + console.info(`ResultSet column names: ${resultSet.columnNames}`); + console.info(`ResultSet column count: ${resultSet.columnCount}`); }).catch((err) => { console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`); }) @@ -2416,9 +2126,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -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}`); return; } - console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); - // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. - 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(); + console.info(`ResultSet column names: ${resultSet.columnNames}`); + console.info(`ResultSet column count: ${resultSet.columnCount}`); }) ``` @@ -2467,26 +2168,17 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** ```js let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'"); promise.then((resultSet) => { - console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); - // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0. - 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(); + console.info(`ResultSet column names: ${resultSet.columnNames}`); + console.info(`ResultSet column count: ${resultSet.columnCount}`); }).catch((err) => { 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 | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -2557,8 +2248,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -2586,8 +2276,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | -------------------------------------------- | -| 14800047 | The WAL file size exceeds the default limit. | -| 14800000 | Inner error. | +| 14800000 | The inner error is occurred. | **Example** @@ -2708,9 +2397,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -2738,20 +2427,20 @@ Backs up an RDB store. This API uses a promise to return the result. | -------- | ------ | ---- | ------------------------ | | destName | string | Yes | Name of the RDB store backup file.| +**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. | + **Return value** | Type | Description | | ------------------- | ------------------------- | | Promise<void> | Promise that returns no value.| -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | - **Example** ```js @@ -2782,9 +2471,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -2822,9 +2511,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -2858,9 +2547,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -2900,9 +2589,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -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. -> **NOTE** +> **NOTE**
> > 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. @@ -2941,9 +2630,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -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. -> **NOTE** +> **NOTE**
> > 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. @@ -3002,9 +2691,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -3053,9 +2742,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -3117,9 +2806,9 @@ 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). -| **ID**| **Error Message** | -| ------------ | ---------------------------- | -| 14800000 | Inner error. | +| **ID**| **Error Message** | +| ------------ | -------------------------------------------- | +| 14800000 | The inner error is occurred. | **Example** @@ -3188,7 +2877,7 @@ try { off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): 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 diff --git a/en/application-dev/reference/apis/js-apis-data-storage.md b/en/application-dev/reference/apis/js-apis-data-storage.md index dbb9244fbe3f973baf0b307a80b7a0ed23482f71..052d9901d7661081cb8a32859eaf154c249a7e03 100644 --- a/en/application-dev/reference/apis/js-apis-data-storage.md +++ b/en/application-dev/reference/apis/js-apis-data-storage.md @@ -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 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 @@ -188,7 +186,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------- | | path | string | Yes | Path of the target file.| -| callback | AsyncCallback<void> | Yes | Callback that returns no value. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** @@ -230,7 +228,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete | Type | Description | | ------------------- | ------------------------------- | -| Promise<void> | Promise that returns no value. | +| Promise<void> | Promise that returns no value.| **Example** @@ -295,7 +293,7 @@ Removes the singleton **Storage** instance of a file from the cache. The removed | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------- | | path | string | Yes | Path of the target file.| -| callback | AsyncCallback<void> | Yes | Callback that returns no value. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** @@ -337,7 +335,7 @@ Removes the singleton **Storage** instance of a file from the cache. The removed | Type | Description | | ------------------- | ------------------------------- | -| Promise<void> | Promise that returns no value. | +| Promise<void> | Promise that returns no value.| **Example** @@ -490,7 +488,7 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat | -------- | ------------------------- | ---- | ----------------------------------------- | | key | string | Yes | Key of the data. It cannot be empty. | | value | [ValueType](#valuetype) | Yes | New value to store. It can be a number, string, or Boolean value.| -| callback | AsyncCallback<void> | Yes | Callback that returns no value. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** @@ -524,7 +522,7 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat | Type | Description | | ------------------- | --------------------------- | -| Promise<void> | Promise that returns no value. | +| Promise<void> | Promise that returns no value.| **Example** @@ -672,7 +670,7 @@ Deletes data with the specified key from this storage object. This API uses an a | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------- | | key | string | Yes | Key of the data. It cannot be empty.| -| callback | AsyncCallback<void> | Yes | Callback that returns no value. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** @@ -705,7 +703,7 @@ Deletes data with the specified key from this storage object. This API uses a pr | Type | Description | | ------------------- | --------------------------- | -| Promise<void> | Promise that returns no value. | +| Promise<void> | Promise that returns no value.| **Example** @@ -746,7 +744,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------- | -| callback | AsyncCallback<void> | Yes | Callback that returns no value. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value.| **Example** @@ -773,7 +771,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz | Type | Description | | ------------------- | --------------------------- | -| Promise<void> | Promise that returns no value. | +| Promise<void> | Promise that returns no value.| **Example** @@ -814,7 +812,7 @@ Clears this **Storage** object. This API uses an asynchronous callback to return | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------- | -| callback | AsyncCallback<void> | Yes | Callback that returns no value. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value.| **Example** @@ -840,7 +838,7 @@ Clears this **Storage** object. This API uses a promise to return the result. **Return value** | Type | Description | | ------------------- | --------------------------- | -| Promise<void> | Promise that returns no value. | +| Promise<void> | Promise that returns no value.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-display.md b/en/application-dev/reference/apis/js-apis-display.md index 15f5d8bdbc7796954b7c7129f3ab43321bba5555..fe1425c33c346b86ce95990d75fe1b8e4ef0764f 100644 --- a/en/application-dev/reference/apis/js-apis-display.md +++ b/en/application-dev/reference/apis/js-apis-display.md @@ -36,10 +36,10 @@ Describes a rectangle on the display. | Name | Type| Readable| Writable| Description | | ------ | -------- | ---- | ---- | ------------------ | -| left | number | Yes | Yes | Left boundary of the rectangle, in pixels.| -| top | number | Yes | Yes | Top boundary of the rectangle, in pixels.| -| width | number | Yes | Yes | Width of the rectangle, in pixels. | -| height | number | Yes | Yes | Height 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. The value must be an integer.| +| 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. The value must be an integer. | ## WaterfallDisplayAreaRects9+ @@ -183,7 +183,7 @@ Checks whether there is a visible privacy window on a display. The privacy windo | 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** @@ -235,10 +235,10 @@ Subscribes to display changes. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | +| Name| Type| Mandatory| Description | +| -------- | -------- | -------- |---------------------------------------------------------------------------------------------------------------------------------| | type | string | Yes| Event type.
- **add**, indicating the display addition event. Example: event that a display is connected.
- **remove**, indicating the display removal event. Example: event that a display is disconnected.
- **change**, indicating the display change event. Example: event that the display orientation is changed.| -| callback | Callback<number> | Yes| Callback used to return the ID of the display.| +| callback | Callback<number> | Yes| Callback used to return the ID of the display, which is an integer. | **Example** @@ -266,7 +266,7 @@ Unsubscribes from display changes. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type.
- **add**, indicating the display addition event. Example: event that a display is connected.
- **remove**, indicating the display removal event. Example: event that a display is disconnected.
- **change**, indicating the display change event. Example: event that the display orientation is changed.| -| callback | Callback<number> | No| Callback used to return the ID of the display.| +| callback | Callback<number> | No| Callback used to return the ID of the display, which is an integer.| **Example** @@ -409,21 +409,21 @@ Before calling any API in **Display**, you must use [getAllDisplays()](#displayg **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| id | number | Yes| No| ID of the display.| -| name | string | Yes| No| Name of the display.| -| alive | boolean | Yes| No| Whether the display is alive.| -| state | [DisplayState](#displaystate) | Yes| No| State of the display.| -| refreshRate | number | Yes| No| Refresh rate of the display.| +| Name| Type| Readable| Writable| Description | +| -------- | -------- | -------- | -------- |---------------------------------------------------------------------------------------------------------------| +| id | number | Yes| No| ID of the display. The value must be an integer. | +| name | string | Yes| No| Name of the display. | +| alive | boolean | Yes| No| Whether the display is alive. | +| state | [DisplayState](#displaystate) | Yes| No| State 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.
The value **0** indicates that the screen of the display rotates by 0°.
The value **1** indicates that the screen of the display rotates by 90°.
The value **2** indicates that the screen of the display rotates by 180°.
The value **3** indicates that the screen of the display rotates by 270°.| -| width | number | Yes| No| Width of the display, in pixels.| -| height | number | Yes| No| Height of the display, in pixels.| -| densityDPI | number | Yes| No| Screen density of the display, that is, the number of dots per inch. Generally, the value is **160** or **480**.| -| 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**.| -| scaledDensity | number | Yes| No| Scaling factor for fonts displayed on the display. 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.| -| yDPI | number | Yes| No| Exact physical dots per inch of the screen in the vertical direction.| +| 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. The value must be an integer. | +| 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. 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. 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. The value must be a floating point number. | +| yDPI | number | Yes| No| Exact physical dots per inch of the screen in the vertical direction. The value must be a floating point number. | ### getCutoutInfo9+ getCutoutInfo(callback: AsyncCallback<CutoutInfo>): void diff --git a/en/application-dev/reference/apis/js-apis-file-fs.md b/en/application-dev/reference/apis/js-apis-file-fs.md index 7f55fb64daecf5c341a39f0e3a79f76df2372c61..a0378e8d89c9468a8e52e6d67c4d89586033ac95 100644 --- a/en/application-dev/reference/apis/js-apis-file-fs.md +++ b/en/application-dev/reference/apis/js-apis-file-fs.md @@ -251,7 +251,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ## fs.close -close(file: File|number): Promise<void> +close(file: number|File): Promise<void> 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 | | ---- | ------ | ---- | ------------ | - | 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** @@ -288,7 +288,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ## fs.close -close(file: File|number, callback: AsyncCallback<void>): void +close(file: number|File, callback: AsyncCallback<void>): void 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 | | -------- | ------------------------- | ---- | ------------ | - | 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<void> | Yes | Callback invoked immediately after the file is closed.| **Error codes** @@ -321,7 +321,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ## fs.closeSync -closeSync(file: File|number): void +closeSync(file: number|File): void Synchronously closes a file. @@ -331,7 +331,7 @@ Synchronously closes a file. | 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** @@ -543,7 +543,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes open(path: string, mode?: number): Promise<File> -Opens a file. This API uses a promise to return the result. File uniform resource identifiers (URIs) are supported. +Opens a file. This API uses a promise to return the result. File uniform resource identifiers (URIs) are supported. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -580,7 +580,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes open(path: string, mode?: number, callback: AsyncCallback<File>): void -Opens a file. This API uses an asynchronous callback to return the result. File URIs are supported. +Opens a file. This API uses an asynchronous callback to return the result. File URIs are supported. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -612,7 +612,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes openSync(path: string, mode?: number): File -Synchronously opens a file. File URIs are supported. +Synchronously opens a file. File URIs are supported. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1239,7 +1239,7 @@ Synchronously reads the text of a file. | Type | Description | | ------ | -------------------- | - | string | Promise used to return the content of the file read.| + | string | Returns the content of the file read.| **Error codes** @@ -1811,6 +1811,8 @@ listFile(path: string, options?: { Lists all files in a directory. This API uses an asynchronous callback to return the result.
This API supports recursive listing of all files (including files in subdirectories) and file filtering. +**System capability**: SystemCapability.FileManagement.File.FileIO + **Parameters** | Name | Type | Mandatory | Description | @@ -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. +**System capability**: SystemCapability.FileManagement.File.FileIO + **Parameters** | Name | Type | Mandatory | Description | @@ -1986,7 +1990,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes ## fs.moveFileSync -moveFile(src: string, dest: string, mode?: number): void +moveFileSync(src: string, dest: string, mode?: number): void Moves a file synchronously. @@ -2933,7 +2937,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes **Example** ```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(() => { console.log("lock file successful"); }).catch((err) => { @@ -2963,7 +2967,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes **Example** ```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) => { if (err) { 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 **Example** ```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); console.log("lock file successful"); ``` @@ -3014,7 +3018,7 @@ For details about the error codes, see [Basic File IO Error Codes](../errorcodes **Example** ```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.unlock(); console.log("unlock file successful"); diff --git a/en/application-dev/reference/apis/js-apis-font.md b/en/application-dev/reference/apis/js-apis-font.md index 0b7d7fb3abcb1353d022e70ea785f6454cd422b4..ce578a35c157539965e3ea810dbc7d646ed83580 100644 --- a/en/application-dev/reference/apis/js-apis-font.md +++ b/en/application-dev/reference/apis/js-apis-font.md @@ -5,6 +5,7 @@ The **font** module provides APIs for registering custom fonts. > **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. +> ## Modules to Import @@ -28,12 +29,14 @@ Registers a custom font with the font manager. ## FontOptions +**System capability**: SystemCapability.ArkUI.ArkUI.Full + | Name | Type | Mandatory | Description | | ---------- | ------ | ---- | ------------ | | familyName | string | Yes | Name of the custom font to register. | | familySrc | string | Yes | Path of the custom font to register.| -## Example +**Example** ```ts // xxx.ets diff --git a/en/application-dev/reference/apis/js-apis-installer.md b/en/application-dev/reference/apis/js-apis-installer.md index ceff24181b2d2506fbcfb77567f4e01cb1d18bee..d47f2f62bc8a497855ae54b41b73acb174e17c2e 100644 --- a/en/application-dev/reference/apis/js-apis-installer.md +++ b/en/application-dev/reference/apis/js-apis-installer.md @@ -471,7 +471,7 @@ Defines the parameters that need to be specified for bundle installation, uninst | 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.| -| 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.| | 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.| diff --git a/en/application-dev/reference/apis/js-apis-matrix4.md b/en/application-dev/reference/apis/js-apis-matrix4.md index b707f54df167497056052a8524ec00d7bbe11188..e2de4ddcedf439f08598e5aa6b7eaca294fb936c 100644 --- a/en/application-dev/reference/apis/js-apis-matrix4.md +++ b/en/application-dev/reference/apis/js-apis-matrix4.md @@ -16,7 +16,7 @@ import matrix4 from '@ohos.matrix4' ## matrix4.init -init(array: Array<number>): 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. @@ -25,17 +25,17 @@ Matrix constructor, which is used to create a 4 x 4 matrix by using the input pa **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------- | ---- | ------------------------------------------------------------ | -| array | Array<number> | Yes | A number array whose length is 16 (4 x 4). For details, see **array** parameters.
Default value:
[1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1] | +| Name| Type | Mandatory| Description | +| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| 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**.
Default value:
[1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1] | **Return value** -| Type | Description | -| -------------- | ---------------------------- | -| Matrix4Transit | 4 x 4 matrix object created based on the input parameter.| +| Type | Description | +| --------------------------------- | ---------------------------- | +| [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 | | ---- | ------ | ---- | -------------------- | @@ -91,9 +91,9 @@ Constructs an identity matrix. **Return value** -| Type | Description | -| -------------- | -------------- | -| Matrix4Transit | Identity matrix object.| +| Type | Description | +| --------------------------------- | -------------- | +| [Matrix4Transit](#matrix4transit) | Identity matrix object.| **Example** @@ -136,9 +136,9 @@ Copies this matrix object. **Return value** -| Type | Description | -| -------------- | -------------------- | -| Matrix4Transit | Copy object of the current matrix.| +| Type | Description | +| --------------------------------- | -------------------- | +| [Matrix4Transit](#matrix4transit) | Copy object of the current matrix.| **Example** @@ -171,12 +171,12 @@ struct Test { ![en-us_image_0000001219744181](figures/en-us_image_0000001219744181.png) -## Matrix4 +## Matrix4Transit ### combine -combine(matrix: Matrix4): Matrix4Transit +combine(options: Matrix4Transit): Matrix4Transit Combines the effects of two matrices to generate a new matrix object. @@ -185,15 +185,15 @@ Combines the effects of two matrices to generate a new matrix object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------- | ---- | ------------------ | -| matrix | Matrix4 | Yes | Matrix object to be combined.| +| Name| Type | Mandatory| Description | +| ------ | --------------------------------- | ---- | ------------------ | +| option | [Matrix4Transit](#matrix4transit) | Yes | Matrix object to be combined.| **Return value** -| Type | Description | -| -------------- | ------------------ | -| Matrix4Transit | Object after matrix combination.| +| Type | Description | +| --------------------------------- | ------------------ | +| [Matrix4Transit](#matrix4transit) | Object after matrix combination.| **Example** @@ -238,9 +238,9 @@ Inverts this matrix object. **Return value** -| Type | Description | -| -------------- | ---------------------- | -| Matrix4Transit | Inverse matrix object of the current matrix.| +| Type | Description | +| --------------------------------- | ---------------------- | +| [Matrix4Transit](#matrix4transit) | Inverse matrix object of the current matrix.| **Example** @@ -273,7 +273,7 @@ struct Tests { ### translate -translate({x?: number, y?: number, z?: number}): Matrix4Transit +translate(options: TranslateOption): Matrix4Transit Translates this matrix object along the x, y, and z axes. @@ -281,17 +281,15 @@ Translates this matrix object along the x, y, and z axes. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ----------------------------------------------------------- | -| x | number | No | Translation distance along the x-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| -| y | number | No | Translation distance along the y-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| -| z | number | No | Translation distance along the z-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| +| Name| Type | Mandatory| Description | +| ------ | ----------------------------------- | ---- | -------------- | +| option | [TranslateOption](#translateoption) | Yes | Translation configuration.| **Return value** -| Type | Description | -| -------------- | ---------------------------- | -| Matrix4Transit | Matrix object after the translation effect is added.| +| Type | Description | +| --------------------------------- | ---------------------------- | +| [Matrix4Transit](#matrix4transit) | Matrix object after the translation.| **Example** @@ -319,7 +317,7 @@ struct Test { ### 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. @@ -328,19 +326,16 @@ Scales this matrix object along the x, y, and z axes. **Parameters** -| 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.
Default value: **1**
Value range: [0, +∞)
**NOTE**
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.
Default value: **1**
Value range: [0, +∞)
**NOTE**
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.
Default value: **1**
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value.| -| centerX | number | No | X coordinate of the center point.
Default value: **0**
Value range: (-∞, +∞) | -| centerY | number | No | Y coordinate of the center point.
Default value: **0**
Value range: (-∞, +∞) | +| Name| Type | Mandatory| Description | +| ------ | --------------------------- | ---- | -------------- | +| option | [ScaleOption](#scaleoption) | Yes | Scaling configuration.| + **Return value** -| Type | Description | -| -------------- | ---------------------------- | -| Matrix4Transit | Matrix object after the scaling effect is added.| +| Type | Description | +| --------------------------------- | ---------------------------- | +| [Matrix4Transit](#matrix4transit) | Matrix object after the scaling.| **Example** @@ -367,7 +362,7 @@ struct Test { ### 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. @@ -376,20 +371,16 @@ Rotates this matrix object along the x, y, and z axes. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | ------------------------------------------------------- | -| x | number | No | X coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| -| y | number | No | Y coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| -| z | number | No | Z coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| -| angle | number | No | Rotation angle.
Default value: **0** | -| centerX | number | No | X coordinate of the center point.
Default value: **0** | -| centerY | number | No | Y coordinate of the center point.
Default value: **0** | +| Name| Type | Mandatory| Description | +| ------ | ----------------------------- | ---- | -------------- | +| option | [RotateOption](#rotateoption) | Yes | Rotation configuration.| + **Return value** -| Type | Description | -| -------------- | ---------------------------- | -| Matrix4Transit | Matrix object after the rotation effect is added.| +| Type | Description | +| --------------------------------- | ---------------------------- | +| [Matrix4Transit](#matrix4transit) | Matrix object after the rotation.| **Example** @@ -417,7 +408,7 @@ struct Test { ### transformPoint -transformPoint(point: Point): Point +transformPoint(options: [number, number]): [number, number] Applies the current transformation effect to a coordinate point. @@ -426,15 +417,15 @@ Applies the current transformation effect to a coordinate point. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ----- | ---- | ------------------ | -| point | Point | Yes | Point to be transformed.| +| Name| Type | Mandatory| Description | +| ------ | ---------------- | ---- | ------------------ | +| option | [number, number] | Yes | Point to be transformed.| **Return value** -| Type | Description | -| ----- | ---------------- | -| Point | Point object after matrix transformation| +| Type | Description | +| ---------------- | --------------------------- | +| [number, number] | Point object after matrix transformation| **Example** @@ -472,3 +463,38 @@ struct Test { ``` ![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.
Default value: **0**
Value range: (-∞, +∞)| +| y | number | No | Translation distance along the y-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| +| z | number | No | Translation distance along the z-axis, in px.
Default value: **0**
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.
Default value: **1**
Value range: [0, +∞)
**NOTE**
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.
Default value: **1**
Value range: [0, +∞)
**NOTE**
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.
Default value: **1**
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value.| +| centerX | number | No | X coordinate of the center point.
Default value: **0**
Value range: (-∞, +∞) | +| centerY | number | No | Y coordinate of the center point.
Default value: **0**
Value range: (-∞, +∞) | + +## RotateOption + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +| Name | Type | Mandatory| Description | +| ------- | ------ | ---- | ------------------------------------------------------- | +| x | number | No | X coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| +| y | number | No | Y coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| +| z | number | No | Z coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| +| angle | number | No | Rotation angle.
Default value: **0** | +| centerX | number | No | X coordinate of the center point.
Default value: **0** | +| centerY | number | No | Y coordinate of the center point.
Default value: **0** | diff --git a/en/application-dev/reference/apis/js-apis-mediaquery.md b/en/application-dev/reference/apis/js-apis-mediaquery.md index b2b8dfd30eb68510227790c45366de315cbb856b..60a66b3f0c4b7e5ed0723e3793c1bd2c07163a2c 100644 --- a/en/application-dev/reference/apis/js-apis-mediaquery.md +++ b/en/application-dev/reference/apis/js-apis-mediaquery.md @@ -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. > -> 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 diff --git a/en/application-dev/reference/apis/js-apis-plugincomponent.md b/en/application-dev/reference/apis/js-apis-plugincomponent.md index 0ae1baf6eebdadbbdc9d43de1e9c100ac73163db..8e809509f0c661ffbe40f83e0adf874ed9c32c85 100644 --- a/en/application-dev/reference/apis/js-apis-plugincomponent.md +++ b/en/application-dev/reference/apis/js-apis-plugincomponent.md @@ -262,7 +262,7 @@ pluginComponentManager.push( name: "ets/pages/plugin2.js", data: { "js": "ets/pages/plugin.js", - "key_1": 1111, , + "key_1": 1111, }, extraData: { "extra_str": "this is push event" @@ -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:
**"push"**: The component provider pushes data to the component consumer.
**"request"**: The component consumer proactively requests data from the component provider.| | callback | [OnPushEventCallback](#onpusheventcallback) \| [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** ```js diff --git a/en/application-dev/reference/apis/js-apis-promptAction.md b/en/application-dev/reference/apis/js-apis-promptAction.md index ca6175a203351e0aeeee4c0fe1c8f617f087f87f..93dfffcfb2792fe982eefa0cfcc9d3ae17ce9644 100644 --- a/en/application-dev/reference/apis/js-apis-promptAction.md +++ b/en/application-dev/reference/apis/js-apis-promptAction.md @@ -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. > -> 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 diff --git a/en/application-dev/reference/apis/js-apis-router.md b/en/application-dev/reference/apis/js-apis-router.md index bb43dd6ce3fb90534f13c8e54cb3d0225396e6df..ccdbaf8baaf24cf5910d8d3d88ac984c2b735433 100644 --- a/en/application-dev/reference/apis/js-apis-router.md +++ b/en/application-dev/reference/apis/js-apis-router.md @@ -671,7 +671,7 @@ struct Second { Text(this.text) .fontSize(30) .onClick(() => { - this.secondData = (this.data.['array'][1]).toString() + this.secondData = (this.data['array'][1]).toString() }) .margin({ top: 20 }) Text(`This is the data passed from the first page: ${this.secondData}`) diff --git a/en/application-dev/reference/apis/js-apis-rpc.md b/en/application-dev/reference/apis/js-apis-rpc.md index 4e2f4ed96e608f1f91cca03faea5188893be128f..22df13e5169b5c8589753aeb553689576e6f7c65 100644 --- a/en/application-dev/reference/apis/js-apis-rpc.md +++ b/en/application-dev/reference/apis/js-apis-rpc.md @@ -247,7 +247,7 @@ Obtains the data size of this **MessageSequence** object. | Type | Description | | ------ | ----------------------------------------------- | - | number | Size of the **MessageSequence** object obtained, in bytes.| + | number | Size of the **MessageSequence** instance obtained, in bytes.| **Example** @@ -293,6 +293,14 @@ Sets the size of the data contained in this **MessageSequence** object. | ------ | ------ | ---- | ------ | | 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** ```ts @@ -326,6 +334,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode | ID| Error Message| | -------- | -------- | + | 1900009 | write data to message sequence failed | | 1900011 | parcel memory alloc failed | **Example** @@ -452,6 +461,12 @@ Moves the read pointer to the specified position. | ------ | ------ | ---- | ------- | | pos | number | Yes | Position from which data is to read.| +**Error codes** + + | ID| Error Message| + | -------- | -------- | + | 1900010 | read data from message sequence failed | + **Example** ```ts @@ -484,6 +499,12 @@ Moves the write pointer to the specified position. | ------ | ------ | ---- | ----- | | pos | number | Yes | Position from which data is to write.| +**Error codes** + + | ID| Error Message| + | -------- | -------- | + | 1900009 | write data to message sequence failed | + **Example** ```ts @@ -2701,7 +2722,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode super(descriptor); this.modifyLocalInterface(this, descriptor); } - + asObject(): rpc.IRemoteObject { return this; } @@ -2718,7 +2739,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### closeFileDescriptor9+ static closeFileDescriptor(fd: number): void @@ -2805,7 +2825,6 @@ Checks whether this **MessageSequence** object contains file descriptors. **Example** - ```ts import fs from '@ohos.file.fs'; let sequence = new rpc.MessageSequence(); @@ -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). | ID| Error Message| - | -------- | ------- | - | 1900003 | write to ashmem failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2948,7 +2967,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### readAshmem readAshmem(): Ashmem @@ -2969,7 +2987,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode | ID| Error Message| | -------- | -------- | - | 1900004 | read from ashmem failed | + | 1900010 | read data from message sequence failed | **Example** @@ -3263,7 +3281,6 @@ Writes an interface token to this **MessageParcel** object. The remote object ca console.log("RpcServer: writeInterfaceToken is " + result); ``` - ### readInterfaceToken readInterfaceToken(): string @@ -3672,7 +3689,7 @@ Writes an Int value to this **MessageParcel** object. **Return value** | Type | Description | - | ------- | ----------------------------- | + | ------- | ----------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -5825,7 +5842,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch | 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. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | 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 | ------- | -------------------------------- | | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| - ### sendRequest8+(deprecated) >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 | 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. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | 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 | -------------------------------- | --------------------------------------------- | | Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| - ### sendMessageRequest9+ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise<RequestResult> @@ -5875,7 +5890,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn | 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. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | 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 | ---------------------------- | ----------------------------------------- | | Promise<RequestResult> | Promise used to return the **requestResult** object.| - ### sendMessageRequest9+ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback<RequestResult>): void @@ -5899,7 +5913,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn | 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. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | 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 | 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. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | 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 | ID| Error Message| | -------- | -------- | - | 1900008 | proxy or remote object is invalid | + | 1900005 | only proxy object permitted | ### addDeathrecipient(deprecated) @@ -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.| - ### unregisterDeathRecipient9+ unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void @@ -5993,7 +6006,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode | ID| Error Message| | -------- | -------- | - | 1900008 | proxy or remote object is invalid | + | 1900005 | only proxy object permitted | ### removeDeathRecipient(deprecated) @@ -6040,7 +6053,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode | -------- | -------- | | 1900008 | proxy or remote object is invalid | - ### getInterfaceDescriptor(deprecated) >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. | ------ | ---------------- | | string | Interface descriptor obtained.| - ### isObjectDead isObjectDead(): boolean @@ -6072,7 +6083,6 @@ Checks whether this object is dead. | ------- | ---------------------------------- | | boolean | Returns **true** if the object is dead; returns **false** otherwise.| - ## RemoteProxy Provides APIs to implement **IRemoteObject**. @@ -6101,7 +6111,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch | 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. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | 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 | 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. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | 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 | 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. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | 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 | 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. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | 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 | 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. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | @@ -7079,13 +7089,12 @@ Provides common message options (flag and wait time). Use the specified flag to **System capability**: SystemCapability.Communication.IPC.Core - | Name | Value | Description | - | ------------- | ---- | ----------------------------------------------------------- | - | TF_SYNC | 0 | Synchronous call. | - | TF_ASYNC | 1 | Asynchronous call. | - | TF_ACCEPT_FDS | 0x10 | Indication to **sendMessageRequest9+** for returning the file descriptor.| - | TF_WAIT_TIME | 8 | Default waiting time, in seconds. | - + | Name | Value | Description | + | ------------- | --------- | ----------------------------------------------------------- | + | TF_SYNC | 0 (0x00) | Synchronous call. | + | TF_ASYNC | 1 (0x01) | Asynchronous call. | + | TF_ACCEPT_FDS | 16 (0x10) | Indication to **sendMessageRequest9+** for returning the file descriptor.| + | TF_WAIT_TIME | 4 (0x4) | Default waiting time, in seconds. | ### constructor9+ @@ -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**.| - **Example** ```ts @@ -7391,7 +7399,6 @@ Obtains the caller's token ID, which is used to verify the caller identity. } ``` - ### getCallingDeviceID static getCallingDeviceID(): string @@ -7484,7 +7491,6 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp | ------ | ------------------------------- | ---- | ------------------- | | object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | - **Example** ```ts @@ -7577,7 +7583,6 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. } ``` - ### restoreCallingIdentity9+ static restoreCallingIdentity(identity: string): void @@ -7667,7 +7672,6 @@ A constructor used to create a **RemoteObject** object. | ---------- | ------ | ---- | ------------ | | descriptor | string | Yes | Interface descriptor.| - ### sendRequest(deprecated) >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 | 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. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | 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 | 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. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | 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 | 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. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | 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 | 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. | | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | | 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 | 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. | | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | @@ -8239,7 +8243,6 @@ Obtains the interface descriptor. | ------------- | --------------------------------------------- | | IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| - **Example** ```ts @@ -8612,7 +8615,6 @@ Creates an **Ashmem** object by copying the file descriptor of an existing **Ash | ------ | ---------------------- | | Ashmem | **Ashmem** object created.| - **Example** ```ts diff --git a/en/application-dev/reference/apis/js-apis-screen.md b/en/application-dev/reference/apis/js-apis-screen.md index 8b9085aebe8d9bfaf47b3641d2cf5dc560d45704..61414685764f2cbfdce6cd709acda40e33880525 100644 --- a/en/application-dev/reference/apis/js-apis-screen.md +++ b/en/application-dev/reference/apis/js-apis-screen.md @@ -95,10 +95,10 @@ Subscribes to events related to the screen state. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ---------------------- | ---- | ------------------------------------------------------------ | +| Name | Type | Mandatory| Description | +| --------- | ---------------------- | ---- | ----------------------------------------------------------- | | eventType | string | Yes | Event type.
- **connect**: an event indicating that the screen is connected.
- **disconnect**: an event indicating that the screen is disconnected.
- **change**: an event indicating that the screen state changes.| -| callback | Callback<number> | Yes | Callback used to return the screen ID. | +| callback | Callback<number> | Yes | Callback used to return the screen ID, which is an integer. | **Example** @@ -126,7 +126,7 @@ Unsubscribes from events related to the screen state. | Name | Type | Mandatory| Description | | --------- | ---------------------- | ---- | ------------------------------------------------------------ | | eventType | string | Yes | Event type.
- **connect**: an event indicating that the screen is connected.
- **disconnect**: an event indicating that the screen is disconnected.
- **change**: an event indicating that the screen state changes.| -| callback | Callback<number> | No | Callback used to return the screen ID. | +| callback | Callback<number> | No | Callback used to return the screen ID, which is an integer. | **Example** @@ -151,10 +151,10 @@ Sets the screen to the expanded mode. This API uses an asynchronous callback to **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------ | ---- | -------------------------------- | -| options | Array<[ExpandOption](#expandoption)> | Yes | Parameters for expanding the screen. | -| callback | AsyncCallback<number> | Yes | Callback used to return the group ID of the expanded screens.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------ | ---- |----------------------------| +| options | Array<[ExpandOption](#expandoption)> | Yes | Parameters for expanding the screen. | +| callback | AsyncCallback<number> | Yes | Callback used to return the group ID of the expanded screens, which is an integer.| **Error codes** @@ -198,9 +198,9 @@ Sets the screen to the expanded mode. This API uses a promise to return the resu **Return value** -| Type | Description | -| --------------------- | ----------------------------------- | -| Promise<number> | Promise used to return the group ID of the expanded screens.| +| Type | Description | +| --------------------- |---------------------------------| +| Promise<number> | Promise used to return the group ID of the expanded screens, which is an integer.| **Error codes** @@ -234,11 +234,11 @@ Sets screen mirroring. This API uses an asynchronous callback to return the resu **Parameters** -| Name | Type | Mandatory| Description | -| ------------ | --------------------------- | ---- |-----------------| -| mainScreen | number | Yes | ID of the primary screen. | -| mirrorScreen | Array<number> | Yes | IDs of secondary screens. | -| callback | AsyncCallback<number> | Yes | Callback used to return the group ID of the secondary screens.| +| Name | Type | Mandatory| Description | +| ------------ | --------------------------- | ---- |--------------------| +| mainScreen | number | Yes | ID of the primary screen. The value must be an integer. | +| mirrorScreen | Array<number> | Yes | IDs of secondary screens. Each ID must be an integer.| +| callback | AsyncCallback<number> | Yes | Callback used to return the group ID of the secondary screens, which is an integer. | **Error codes** @@ -276,16 +276,16 @@ Sets screen mirroring. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory| Description | -| ------------ | ------------------- | ---- |-----------| -| mainScreen | number | Yes | ID of the primary screen. | -| mirrorScreen | Array<number> | Yes | IDs of secondary screens.| +| Name | Type | Mandatory| Description | +| ------------ | ------------------- | ---- |--------------------| +| mainScreen | number | Yes | ID of the primary screen. The value must be an integer. | +| mirrorScreen | Array<number> | Yes | IDs of secondary screens. Each ID must be an integer.| **Return value** -| Type | Description | -| --------------------- | ----------------------------------- | -| Promise<number> | Promise used to return the group ID of the secondary screens.| +| Type | Description | +| --------------------- |---------------------------------| +| Promise<number> | Promise used to return the group ID of the secondary screens, which is an integer.| **Error codes** @@ -424,7 +424,7 @@ Destroys a virtual screen. This API uses an asynchronous callback to return the | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| screenId | number | Yes | Screen ID. | +| screenId | number | Yes | Screen ID. The value must be an integer. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. If the virtual screen is destroyed, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** @@ -464,7 +464,7 @@ Destroys a virtual screen. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ---------- | -| screenId | number | Yes | Screen ID.| +| screenId | number | Yes | Screen ID. The value must be an integer.| **Return value** @@ -509,7 +509,7 @@ Sets the surface for a virtual screen. This API uses an asynchronous callback to | 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. | | callback | AsyncCallback<void> | 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 | 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.| **Return value** @@ -711,9 +711,9 @@ Defines the parameters for expanding a screen. | Name | Type| Readable| Writable| Description | | -------- | -------- | ---- | ---- | ------------------- | -| screenId | number | Yes | Yes | Screen ID. | -| startX | number | Yes | Yes | Start X coordinate of the screen.| -| startY | number | Yes | Yes | Start Y coordinate of the screen.| +| screenId | number | Yes | Yes | Screen ID. The value must be an integer. | +| 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. The value must be an integer.| ## VirtualScreenOption @@ -721,13 +721,13 @@ Defines virtual screen parameters. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type| Readable| Writable| Description | -| --------- | -------- | ---- | ---- | ------------------------- | -| name | string | Yes | Yes | Name of a virtual screen. | -| width | number | Yes | Yes | Width of the virtual screen, in pixels.| -| height | number | Yes | Yes | Height of the virtual screen, in pixels.| -| density | number | Yes | Yes | Density of the virtual screen. | -| surfaceId | string | Yes | Yes | Surface ID of the virtual screen.| +| Name | Type| Readable| Writable| Description | +| --------- | -------- | ---- | ---- |--------------------------| +| name | string | Yes | Yes | Name of a virtual screen. | +| 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. The value must be an integer.| +| 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. | ## Screen @@ -737,13 +737,13 @@ Before calling any API in **Screen**, you must use **[getAllScreens()](#screenge **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Readable| Writable| Description | -| ----------------- | ---------------------------------------------- | ---- | ---- | ---------------------- | -| id | number | Yes | No | Screen ID. | -| parent | number | Yes | No | ID of the group to which a screen belongs. | -| supportedModeInfo | Array<[ScreenModeInfo](#screenmodeinfo)> | 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.| -| orientation | [Orientation](#orientation) | Yes | No | Screen orientation. | +| Name | Type | Readable| Writable| Description | +| ----------------- | ---------------------------------------------- | ---- | ---- |-------------------------------------------------------------| +| 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. The value must be an integer. | +| supportedModeInfo | Array<[ScreenModeInfo](#screenmodeinfo)> | 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. The value must be an integer.| +| orientation | [Orientation](#orientation) | Yes | No | Screen orientation. | ### setOrientation @@ -833,7 +833,7 @@ Sets the active mode of the screen. This API uses an asynchronous callback to re | 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<void> | 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** @@ -871,7 +871,7 @@ Sets the active mode of the screen. This API uses a promise to return the result | 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** @@ -911,9 +911,9 @@ Sets the pixel density of the screen. This API uses an asynchronous callback to **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Mandatory| Description | -| ---------- | ------------------------- | ---- | ------------------------------------------------------------ | -| densityDpi | number | Yes | Pixel density. The value ranges from 80 to 640. | +| Name | Type | Mandatory| Description | +| ---------- | ------------------------- | ---- |------------------------------------------| +| densityDpi | number | Yes | Pixel density. The value must be an integer in the range [80, 640]. | | callback | AsyncCallback<void> | 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** @@ -949,9 +949,9 @@ Sets the pixel density of the screen. This API uses a promise to return the resu **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | ---------------------------------- | -| densityDpi | number | Yes | Pixel density. The value ranges from 80 to 640.| +| Name | Type | Mandatory| Description | +| ---------- | ------ | ---- |------------------------------------| +| densityDpi | number | Yes | Pixel density. The value must be an integer in the range [80, 640].| **Return value** @@ -1005,7 +1005,7 @@ Defines the screen mode information. | Name | Type| Readable| Writable| Description | | ----------- | -------- | ---- | ---- | -------------------------------------------------- | -| id | number | Yes | Yes | Mode ID. The supported mode is determined by the device resolution and refresh rate.| -| width | number | Yes | Yes | Width of the screen, in pixels. | -| height | number | Yes | Yes | Height of the screen, in pixels. | -| refreshRate | number | Yes | Yes | Screen 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. The value must be an integer. | +| height | number | Yes | Yes | Height of the screen, in pixels. The value must be an integer. | +| refreshRate | number | Yes | Yes | Refresh rate of the screen. The value must be an integer. | diff --git a/en/application-dev/reference/apis/js-apis-screenshot.md b/en/application-dev/reference/apis/js-apis-screenshot.md index 9f71307457259b7900032e38fa0f15f28cdda4b9..7cb437acb05f67079800a4d181d4c5d4320fa98e 100644 --- a/en/application-dev/reference/apis/js-apis-screenshot.md +++ b/en/application-dev/reference/apis/js-apis-screenshot.md @@ -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. | | 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**. | -| displayId8+ | number | No | ID of the [display](js-apis-display.md#display) device on which the screen region is to be captured.| +| 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. | +| displayId8+ | 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 @@ -37,10 +37,10 @@ Describes the region of the screen to capture. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| left | number | Yes | Left boundary of the screen region to capture, in pixels.| -| top | number | Yes | Top boundary of the screen region to capture, in pixels.| -| width | number | Yes | Width of the screen region to capture, in pixels.| -| height | number | Yes | Height 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. The value must be an integer.| +| 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. The value must be an integer.| ## Size @@ -51,8 +51,8 @@ Describes the size of the screen region to capture. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| width | number | Yes | Width of the screen region to capture, in pixels.| -| height | number | Yes | Height 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. The value must be an integer.| ## screenshot.save @@ -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)); 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. }); } catch (exception) { @@ -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)); 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. }); } catch (exception) { @@ -173,7 +173,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses a promis try { let promise = screenshot.save(screenshotOptions); 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. }).catch((err) => { console.log('Failed to save screenshot. Code: ' + JSON.stringify(err)); diff --git a/en/application-dev/reference/apis/js-apis-settings.md b/en/application-dev/reference/apis/js-apis-settings.md index e888b0ef9b89fcad43556e271db6e5a6fceaeea0..2acac025ffeffe32677f5af17b1e1cabfeb6655b 100644 --- a/en/application-dev/reference/apis/js-apis-settings.md +++ b/en/application-dev/reference/apis/js-apis-settings.md @@ -249,7 +249,7 @@ Sets the value for a data item. This API uses a promise to return the result. ```js 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 helper = featureAbility.acquireDataAbilityHelper(uri); // @ts-ignore @@ -265,6 +265,8 @@ enableAirplaneMode(enable: boolean, callback: AsyncCallback\): void 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 **Parameters** @@ -293,6 +295,8 @@ enableAirplaneMode(enable: boolean): Promise\ 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 **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-stationary.md b/en/application-dev/reference/apis/js-apis-stationary.md index cb2f0f4432a5547960ef175e3ddd9a147515f0c9..97b3a2f7cfe2077875906c22d0983b422673d3c5 100644 --- a/en/application-dev/reference/apis/js-apis-stationary.md +++ b/en/application-dev/reference/apis/js-apis-stationary.md @@ -123,7 +123,7 @@ Unsubscribes from the device status. | -------------------- | -------------------------------------------------- | ---- | ---------------------------- | | activity | [ActivityType](#activitytype) | Yes | Device status 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** diff --git a/en/application-dev/reference/apis/js-apis-uitest.md b/en/application-dev/reference/apis/js-apis-uitest.md index 3b0ee56a7bef48b0bee0bcdae5c6a781d0ba2b86..13bb7707f465fb5af21a749a64eab15b7e57d1d4 100644 --- a/en/application-dev/reference/apis/js-apis-uitest.md +++ b/en/application-dev/reference/apis/js-apis-uitest.md @@ -8,9 +8,9 @@ This module provides the following functions: - [Component9+](#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. - [Driver9+](#driver9): works as the entry class and provides APIs for features such as component matching/search, key injection, coordinate clicking/sliding, and screenshot. - [UiWindow9+](#uiwindow9): works as the entry class and provides APIs for obtaining window attributes, dragging windows, and adjusting window sizes. -- [By(deprecated)](#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 [On9+](#on9) instead. -- [UiComponent(deprecated)](#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 [Component9+](#component9) instead. -- [UiDriver(deprecated)](#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 [Driver9+](#driver9) instead. +- [By(deprecated)](#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 [On9+](#on9) instead. +- [UiComponent(deprecated)](#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 [Component9+](#component9) instead. +- [UiDriver(deprecated)](#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 [Driver9+](#driver9) instead. >**NOTE** > @@ -1119,7 +1119,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc ```js async function demo() { 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')); } ``` @@ -2659,6 +2659,7 @@ async function demo() { ## By(deprecated) 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: - 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 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 [On9+](#on9) instead. +This class is deprecated since API version 9. You are advised to use [On9+](#on9) instead. ```js BY.text('123').type('button'); @@ -2909,7 +2910,7 @@ selected(b?: boolean): By Specifies the selected status of the target component. -This API is deprecated since API version 9. You are advised to use [selected9+](#selected9). +This API is deprecated since API version 9. You are advised to use [selected9+](#selected9) instead. **System capability**: SystemCapability.Test.UiTest @@ -2937,7 +2938,7 @@ isBefore(by: By): By 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 [isBefore9+](#isbefore9). +This API is deprecated since API version 9. You are advised to use [isBefore9+](#isbefore9) instead. **System capability**: SystemCapability.Test.UiTest @@ -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. 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 [Component9+](#component9) instead. +This class is deprecated since API version 9. You are advised to use [Component9+](#component9) instead. ### click(deprecated) @@ -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. 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 [Driver9+](#driver9) instead. +This class is deprecated since API version 9. You are advised to use [Driver9+](#driver9) instead. ### create(deprecated) diff --git a/en/application-dev/reference/apis/js-apis-wifiManager.md b/en/application-dev/reference/apis/js-apis-wifiManager.md index 8e3526343a3f62066af7686b4fbe5cb587fa1cbc..bd8bae5e1c450143ce183ff29881445e413dc79b 100644 --- a/en/application-dev/reference/apis/js-apis-wifiManager.md +++ b/en/application-dev/reference/apis/js-apis-wifiManager.md @@ -1,5 +1,4 @@ -# 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. > **NOTE** @@ -31,6 +30,14 @@ Enables WLAN. | -------- | -------- | | 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.disableWifi9+ @@ -50,6 +57,13 @@ Disables WLAN. | -------- | -------- | | 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.isWifiActive9+ @@ -67,6 +81,13 @@ Checks whether WLAN is enabled. | -------- | -------- | | 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.scan9+ @@ -74,7 +95,7 @@ scan(): void 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 @@ -84,6 +105,13 @@ Starts a scan for WLAN. | -------- | -------- | | 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.getScanResults9+ @@ -101,6 +129,13 @@ Obtains the scan result. This API uses a promise to return the result. | -------- | -------- | | Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | 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.getScanResults9+ @@ -118,6 +153,14 @@ Obtains the scan result. This API uses an asynchronous callback to return the re | -------- | -------- | -------- | -------- | | callback | AsyncCallback< Array<[WifiScanInfo](#wifiscaninfo)>> | 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** ```js import wifi from '@ohos.wifi'; @@ -251,6 +294,13 @@ Obtains the scan result. This API returns the result synchronously. | -------- | -------- | |  Array<[WifiScanInfo](#wifiscaninfo)> | 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.addDeviceConfig9+ @@ -276,6 +326,14 @@ Adds network configuration. This API uses a promise to return the result. | -------- | -------- | | Promise<number> | 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.| + ## WifiDeviceConfig9+ Represents the WLAN configuration. @@ -351,6 +409,8 @@ Represents EAP configuration information. | caCertAliases | string | Yes| No| CA certificate alias.| | caPath | string | Yes| No| CA certificate path.| | 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.| | domainSuffixMatch | string | Yes| No| A string to match the domain suffix.| | 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 | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.| | callback | AsyncCallback<number> | 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.addCandidateConfig9+ @@ -441,6 +508,13 @@ Adds the configuration of a candidate network. This API uses a promise to return | -------- | -------- | | Promise<number> | 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.addCandidateConfig9+ @@ -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.| | callback | AsyncCallback<number> | 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.removeCandidateConfig9+ @@ -482,6 +563,13 @@ Removes the configuration of a candidate network. This API uses a promise to ret | -------- | -------- | | Promise<void> | 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.removeCandidateConfig9+ @@ -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.| | callback | AsyncCallback<void> | 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.getCandidateConfigs9+ @@ -517,6 +612,13 @@ Obtains candidate network configuration. | -------- | -------- | |  Array<[WifiDeviceConfig](#wifideviceconfig)> | 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.connectToCandidateConfig9+ @@ -534,6 +636,14 @@ Connects to a candidate network. | -------- | -------- | -------- | -------- | | 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.connectToNetwork9+ @@ -553,12 +663,14 @@ Connects to the specified network. | -------- | -------- | -------- | -------- | | networkId | number | Yes| Network configuration ID.| -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +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.connectToDevice9+ @@ -579,12 +691,14 @@ Connects to the specified network. | -------- | -------- | -------- | -------- | | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration.| -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +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.disconnect9+ @@ -599,12 +713,13 @@ Disconnects the network. **System capability**: SystemCapability.Communication.WiFi.STA -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2501000 | Operation failed.| ## wifi.getSignalLevel9+ @@ -629,6 +744,13 @@ Obtains the WLAN signal level. | -------- | -------- | | 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.getLinkedInfo9+ @@ -646,6 +768,14 @@ Obtains WLAN connection information. This API uses a promise to return the resul | -------- | -------- | | Promise<[WifiLinkedInfo](#wifilinkedinfo)> | 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.getLinkedInfo9+ @@ -663,6 +793,15 @@ Obtains WLAN connection information. This API uses an asynchronous callback to r | -------- | -------- | -------- | -------- | | callback | AsyncCallback<[WifiLinkedInfo](#wifilinkedinfo)> | 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** ```js import wifi from '@ohos.wifi'; @@ -767,6 +906,13 @@ Checks whether the WLAN is connected. | -------- | -------- | | 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.getSupportedFeatures9+ @@ -795,12 +941,19 @@ Obtains the features supported by this device. | 0x0004 | Generic Advertisement Service (GAS)/Access Network Query Protocol (ANQP) feature| | 0x0008 | Wi-Fi Direct| | 0x0010 | SoftAP| -| 0x0040 | Wi-Fi AWare| +| 0x0040 | Wi-Fi Aware| | 0x8000 | WLAN AP/STA concurrency| | 0x8000000 | WPA3 Personal (WPA-3 SAE)| | 0x10000000 | WPA3-Enterprise Suite B | | 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.isFeatureSupported9+ @@ -825,6 +978,13 @@ Checks whether the device supports the specified WLAN feature. | -------- | -------- | | 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.getDeviceMacAddress9+ @@ -844,6 +1004,13 @@ Obtains the device MAC address. | -------- | -------- | | 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.getIpInfo9+ @@ -861,6 +1028,13 @@ Obtains IP information. | -------- | -------- | | [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.| ## IpInfo9+ @@ -895,6 +1069,13 @@ Obtains the country code. | -------- | -------- | | 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.reassociate9+ @@ -908,12 +1089,14 @@ Re-associates with the network. **System capability**: SystemCapability.Communication.WiFi.STA -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +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.reconnect9+ @@ -927,12 +1110,14 @@ Reconnects to the network. **System capability**: SystemCapability.Communication.WiFi.STA -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +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.getDeviceConfigs9+ @@ -952,6 +1137,13 @@ Obtains network configuration. | -------- | -------- | |  Array<[WifiDeviceConfig](#wifideviceconfig)> | 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.updateNetwork9+ @@ -977,6 +1169,13 @@ Updates network configuration. | -------- | -------- | | 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.disableNetwork9+ @@ -996,12 +1195,13 @@ Disables network configuration. | -------- | -------- | -------- | -------- | | netId | number | Yes| ID of the network configuration to disable.| -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2501000 | Operation failed.| ## wifi.removeAllNetwork9+ @@ -1015,12 +1215,13 @@ Removes the configuration of all networks. **System capability**: SystemCapability.Communication.WiFi.STA -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2501000 | Operation failed.| ## wifi.removeDevice9+ @@ -1038,14 +1239,15 @@ Removes the specified network configuration. | **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**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2501000 | Operation failed.| ## wifi.enableHotspot9+ @@ -1059,12 +1261,13 @@ Enables this hotspot. **System capability**: SystemCapability.Communication.WiFi.AP.Core -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2601000 | Operation failed.| ## wifi.disableHotspot9+ @@ -1078,12 +1281,13 @@ Disables this hotspot. **System capability**: SystemCapability.Communication.WiFi.AP.Core -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2601000 | Operation failed.| ## wifi.isHotspotDualBandSupported9+ @@ -1103,6 +1307,13 @@ Checks whether the hotspot supports dual band. | -------- | -------- | | 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.isHotspotActive9+ @@ -1122,6 +1333,13 @@ Checks whether this hotspot is active. | -------- | -------- | | 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.setHotspotConfig9+ @@ -1141,12 +1359,13 @@ Sets hotspot configuration. | -------- | -------- | -------- | -------- | | config | [HotspotConfig](#hotspotconfig9) | Yes| Hotspot configuration to set.| -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2601000 | Operation failed.| ## HotspotConfig9+ @@ -1169,7 +1388,7 @@ Represents the hotspot configuration. getHotspotConfig(): HotspotConfig -obtains hotspot configuration. +Obtains hotspot configuration. **System API**: This is a system API. @@ -1183,6 +1402,13 @@ obtains hotspot configuration. | -------- | -------- | | [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.getStations9+ @@ -1202,6 +1428,13 @@ Obtains information about the connected stations. | -------- | -------- | |  Array<[StationInfo](#stationinfo9)> | 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.| ## StationInfo9+ @@ -1234,7 +1467,13 @@ Obtains P2P link information. This API uses a promise to return the result. | -------- | -------- | | Promise<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | 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.| ## WifiP2pLinkedInfo9+ @@ -1294,6 +1533,13 @@ Obtains the current P2P group information. This API uses a promise to return the | -------- | -------- | | Promise<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> | 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.getCurrentGroup9+ @@ -1311,6 +1557,13 @@ Obtains the current P2P group information. This API uses an asynchronous callbac | -------- | -------- | -------- | -------- | | callback | AsyncCallback<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> | 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.getP2pPeerDevices9+ @@ -1328,6 +1581,13 @@ Obtains the peer device list in the P2P connection. This API uses a promise to r | -------- | -------- | | Promise<[WifiP2pDevice[]](#wifip2pdevice9)> | 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.getP2pPeerDevices9+ @@ -1345,6 +1605,13 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou | -------- | -------- | -------- | -------- | | callback | AsyncCallback<[WifiP2pDevice[]](#wifip2pdevice9)> | 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.| ## WifiP2pDevice9+ @@ -1392,6 +1659,13 @@ Obtains the local device information in the P2P connection. This API uses a prom | -------- | -------- | | Promise<[WifiP2pDevice](#wifip2pdevice9)> | 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.getP2pLocalDevice9+ @@ -1426,12 +1700,13 @@ Creates a P2P group. | -------- | -------- | -------- | -------- | | config | [WifiP2PConfig](#wifip2pconfig9) | Yes| Group configuration.| -**Return value** +**Error codes** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2801000 | Operation failed.| ## WifiP2PConfig9+ @@ -1471,12 +1746,13 @@ Removes this P2P group. **System capability**: SystemCapability.Communication.WiFi.P2P -**Return value** +**Error codes** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2801000 | Operation failed.| ## wifi.p2pConnect9+ @@ -1495,12 +1771,13 @@ Sets up a P2P connection. | -------- | -------- | -------- | -------- | | config | [WifiP2PConfig](#wifip2pconfig9) | Yes| P2P group configuration.| -**Return value** +**Error codes** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2801000 | Operation failed.| **Example** ```js @@ -1579,12 +1856,13 @@ Cancels this P2P connection. **System capability**: SystemCapability.Communication.WiFi.P2P -**Return value** +**Error codes** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2801000 | Operation failed.| ## wifi.startDiscoverDevices9+ @@ -1596,12 +1874,13 @@ Starts to discover devices. **System capability**: SystemCapability.Communication.WiFi.P2P -**Return value** +**Error codes** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2801000 | Operation failed.| ## wifi.stopDiscoverDevices9+ @@ -1613,12 +1892,13 @@ Stops discovering devices. **System capability**: SystemCapability.Communication.WiFi.P2P -**Return value** +**Error codes** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2801000 | Operation failed.| ## wifi.deletePersistentGroup9+ @@ -1639,12 +1919,13 @@ Deletes a persistent group. | -------- | -------- | -------- | -------- | | netId | number | Yes| ID of the group to delete.| -**Return value** +**Error codes** - | Type| Description| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2801000 | Operation failed.| ## wifi.getP2pGroups9+ @@ -1664,6 +1945,13 @@ Obtains information about all P2P groups. This API uses a promise to return the | -------- | -------- | | Promise< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> > | 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.| ## WifiP2pGroupInfo9+ @@ -1702,6 +1990,13 @@ Obtains information about all P2P groups. This API uses an asynchronous callback | -------- | -------- | -------- | -------- | | callback | AsyncCallback< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo9)>> | 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.setDeviceName9+ @@ -1721,12 +2016,13 @@ Sets the device name. | -------- | -------- | -------- | -------- | | devName | string | Yes| Device name to set.| -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| + | -------- | -------- | +| 2801000 | Operation failed.| ## wifi.on('wifiStateChange')9+ @@ -1745,6 +2041,14 @@ Registers the WLAN state change events. | type | string | Yes| Event type. The value is **wifiStateChange**.| | callback | Callback<number> | 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** | **Value**| **Description**| @@ -1772,6 +2076,14 @@ Unregisters the WLAN state change events. | type | string | Yes| Event type. The value is **wifiStateChange**.| | callback | Callback<number> | 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** ```js import wifi from '@ohos.wifi'; @@ -1788,7 +2100,7 @@ Unregisters the WLAN state change events. ``` -## wifi.on('wifiConnectionChange')7+ +## wifi.on('wifiConnectionChange')9+ on(type: "wifiConnectionChange", callback: Callback<number>): void @@ -1812,6 +2124,13 @@ Registers the WLAN connection state change events. | 0 | Disconnected.| | 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')9+ @@ -1830,6 +2149,13 @@ Unregisters the WLAN connection state change events. | type | string | Yes| Event type. The value is **wifiConnectionChange**.| | callback | Callback<number> | 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')9+ @@ -1855,6 +2181,13 @@ Registers the WLAN scan state change events. | 0 | Scan failed.| | 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')9+ @@ -1873,6 +2206,13 @@ Unregisters the WLAN scan state change events. | type | string | Yes| Event type. The value is **wifiScanStateChange**.| | callback | Callback<number> | 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')9+ @@ -1891,6 +2231,13 @@ Registers the RSSI change events. | type | string | Yes| Event type. The value is **wifiRssiChange**.| | callback | Callback<number> | 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')9+ @@ -1909,6 +2256,13 @@ Unregisters the RSSI change events. | type | string | Yes| Event type. The value is **wifiRssiChange**.| | callback | Callback<number> | 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')9+ @@ -1936,6 +2290,13 @@ Registers the hotspot state change events. | 2 | Activating| | 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')9+ @@ -1954,6 +2315,13 @@ Unregisters the hotspot state change events. | type | string | Yes| Event type. The value is **hotspotStateChange**.| | callback | Callback<number> | 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')9+ @@ -1982,6 +2350,14 @@ Registers the P2P state change events. | 4 | Closing| | 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')9+ off(type: "p2pStateChange", callback?: Callback<number>): void @@ -1999,6 +2375,13 @@ Unregisters the P2P state change events. | type | string | Yes| Event type. The value is **p2pStateChange**.| | callback | Callback<number> | 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')9+ @@ -2017,6 +2400,13 @@ Registers the P2P connection state change events. | type | string | Yes| Event type. The value is **p2pConnectionChange**.| | callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | 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')9+ @@ -2035,6 +2425,13 @@ Unregisters the P2P connection state change events. | type | string | Yes| Event type. The value is **p2pConnectionChange**.| | callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | 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')9+ @@ -2053,6 +2450,13 @@ Registers the P2P device state change events. | type | string | Yes| Event type. The value is **p2pDeviceChange**.| | callback | Callback<[WifiP2pDevice](#wifip2pdevice9)> | 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')9+ @@ -2071,6 +2475,13 @@ Unregisters the P2P device state change events. | type | string | Yes| Event type. The value is **p2pDeviceChange**.| | callback | Callback<[WifiP2pDevice](#wifip2pdevice9)> | 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')9+ @@ -2089,6 +2500,13 @@ Registers the P2P peer device state change events. | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| | callback | Callback<[WifiP2pDevice[]](#wifip2pdevice9)> | 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')9+ @@ -2107,6 +2525,13 @@ Unregisters the P2P peer device state change events. | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| | callback | Callback<[WifiP2pDevice[]](#wifip2pdevice9)> | 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')9+ @@ -2125,6 +2550,13 @@ Registers the P2P persistent group state change events. | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| | callback | Callback<void> | 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')9+ @@ -2143,6 +2575,13 @@ Unregisters the P2P persistent group state change events. | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| | callback | Callback<void> | 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')9+ @@ -2168,6 +2607,13 @@ Registers the P2P device discovery state change events. | 0 | Initial state.| | 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')9+ @@ -2185,3 +2631,11 @@ Unregisters the P2P device discovery state change events. | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value is **p2pDiscoveryChange**.| | callback | Callback<number> | 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.| diff --git a/en/application-dev/reference/apis/js-apis-wifiManagerExt.md b/en/application-dev/reference/apis/js-apis-wifiManagerExt.md index f024294ddbc393a57394a1ad20d2686d30060e52..9e274ab40504c4cb192d0863e774168a9f3db15e 100644 --- a/en/application-dev/reference/apis/js-apis-wifiManagerExt.md +++ b/en/application-dev/reference/apis/js-apis-wifiManagerExt.md @@ -1,11 +1,11 @@ -# WLAN Extension Interface +# @ohos.wifiManagerExt (WLAN Extension) This **wifiext** module provides WLAN extension interfaces for non-universal products. > **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 APIs described in this document are used only for non-universal products, such as routers. +> +> - 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. ## Modules to Import @@ -14,9 +14,9 @@ The APIs described in this document are used only for non-universal products, su import wifiManagerExt from '@ohos.wifiManagerExt'; ``` -## wifiext.enableHotspot +## wifiext.enableHotspot9+ -enableHotspot(): boolean; +enableHotspot(): void; Enables the WLAN hotspot. @@ -24,16 +24,17 @@ Enables the WLAN hotspot. **System capability**: SystemCapability.Communication.WiFi.AP.Extension -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| +| -------- | -------- | +| 2701000 | Operation failed.| -## wifiext.disableHotspot +## wifiext.disableHotspot9+ -disableHotspot(): boolean; +disableHotspot(): void; Disables the WLAN hotspot. @@ -41,18 +42,19 @@ Disables the WLAN hotspot. **System capability**: SystemCapability.Communication.WiFi.AP.Extension -**Return value** +**Error codes** - | **Type**| **Description**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). +| **Type**| **Description**| +| -------- | -------- | +| 2701000 | Operation failed.| -## wifiext.getSupportedPowerModel +## wifiext.getSupportedPowerMode9+ -getSupportedPowerModel(): Promise<Array<PowerModel>> +getSupportedPowerMode(): Promise<Array<PowerMode>> -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 @@ -60,14 +62,21 @@ Obtains the supported power models. This API uses a promise to return the result **Return value** - | Type| Description| - | -------- | -------- | - | Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.| +| Type| Description| +| -------- | -------- | +| Promise<Array<[PowerMode](#powermode)>> | 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 @@ -78,11 +87,11 @@ Enumerates the power models. | THROUGH_WALL | 2 | Through_wall| -## wifiext.getSupportedPowerModel +## wifiext.getSupportedPowerMode9+ -getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void +getSupportedPowerMode(callback: AsyncCallback<Array<PowerMode>>): 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 @@ -90,16 +99,23 @@ Obtains the supported power models. This API uses an asynchronous callback to re **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<Array<[PowerModel](#powermodel)>> | 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.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<Array<[PowerMode](#powermode)>> | 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.getPowerMode9+ -getPowerModel(): Promise<PowerModel> +getPowerMode(): Promise<PowerMode> -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 @@ -107,16 +123,23 @@ Obtains the power model. This API uses a promise to return the result. **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[PowerModel](#powermodel)> | Promise used to return the power model obtained.| +| Type| Description| +| -------- | -------- | +| Promise<[PowerMode](#powermode)> | 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<PowerModel>): void +| **Type**| **Description**| +| -------- | -------- | +| 2701000 | Operation failed.| -Obtains the power model. This API uses an asynchronous callback to return the result. +## wifiext.getPowerMode9+ + +getPowerMode(callback: AsyncCallback<PowerMode>): void + +Obtains the power mode. This API uses an asynchronous callback to return the result. **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 **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[PowerModel](#powermodel)> | 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.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<[PowerMode](#powermode)> | 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.setPowerMode9+ - Sets the power model. +setPowerMode(model: PowerMode) : boolean; + + Sets the power mode. **Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT @@ -141,12 +171,14 @@ setPowerModel(model: PowerModel) : boolean; **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | model | [PowerModel](#powermodel) | Yes| Power model to set.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| 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**| - | -------- | -------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| **Type**| **Description**| +| -------- | -------- | +| 2701000 | Operation failed.| diff --git a/en/application-dev/reference/apis/js-apis-window.md b/en/application-dev/reference/apis/js-apis-window.md index 6b9b174376dec02011f7301671b448988eeaa23d..7a9a4b303be2b022b3b19adecf31c2ba09d3be27 100644 --- a/en/application-dev/reference/apis/js-apis-window.md +++ b/en/application-dev/reference/apis/js-apis-window.md @@ -50,13 +50,13 @@ Defines the parameters for creating a subwindow or system window. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name| Type| Mandatory| Description| -| ---------- | -------------------------- | -- | ----------------------------------- | -| name | string | Yes| Name 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.
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.| -| parentId | number | No| ID of the parent window. If this parameter is not set, the default value **-1** is used. | +| Name| Type| Mandatory| Description | +| ---------- | -------------------------- | -- |-----------------------------------------------------------------------------| +| name | string | Yes| Name of the window. | +| windowType | [WindowType](#windowtype7) | Yes| Type of the window. | +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | No| Current application context. If no value is passed, no context is used.
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 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 no value is passed, the default value **-1** is used. The value must be an integer. | ## AvoidAreaType7+ @@ -108,10 +108,10 @@ Describes the properties of the status bar and navigation bar. | 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**.| | isStatusBarLightIcon7+ | 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**.| | statusBarContentColor8+ | 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**.| | isNavigationBarLightIcon7+ | 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**.| | navigationBarContentColor8+ | 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. | 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.| | 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. | ## SystemBarTintState8+ @@ -177,7 +177,7 @@ Describes the callback for the current system bar. | 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.| ## Rect7+ @@ -188,10 +188,10 @@ Describes the rectangular area of the window. | Name | Type| Readable| Writable| Description | | ------ | -------- | ---- | ---- | ------------------ | -| left | number | Yes | Yes | Left boundary of the rectangle, in pixels.| -| top | number | Yes | Yes | Top boundary of the rectangle, in pixels.| -| width | number | Yes | Yes | Width of the rectangle, in pixels.| -| height | number | Yes | Yes | Height 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. The value must be an integer.| +| 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. The value must be an integer.| ## AvoidArea7+ @@ -215,8 +215,8 @@ Describes the window size. | Name | Type| Readable| Writable| Description | | ------ | -------- | ---- | ---- | ---------- | -| width | number | Yes | Yes | Window width, in pixels.| -| height | number | Yes | Yes | Window height, in pixels.| +| width | number | Yes | Yes | Window width, in pixels. The value must be an integer.| +| height | number | Yes | Yes | Window height, in pixels. The value must be an integer.| ## WindowProperties @@ -224,21 +224,21 @@ Describes the window properties. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Readable| Writable| Description | -| ------------------------------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | -| windowRect7+ | [Rect](#rect7) | Yes | Yes | Window size. | -| type7+ | [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.| -| isLayoutFullScreen7+ | 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.| -| focusable7+ | 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.| -| touchable7+ | 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.| -| dimBehindValue(deprecated) | 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.
**NOTE**
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.| -| isPrivacyMode7+ | 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(deprecated) | 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.
**NOTE**
This property is supported since API version 7 and deprecated since API version 9.
| -| isTransparent7+ | 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.| -| id9+ | number | Yes | No | Window ID. The default value is **0.0**. | +| Name | Type | Readable| Writable| Description | +| ------------------------------------- | ------------------------- | ---- | ---- |--------------------------------------------------------------------------------------------------------| +| windowRect7+ | [Rect](#rect7) | Yes | Yes | Window size. | +| type7+ | [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. | +| isLayoutFullScreen7+ | 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. | +| focusable7+ | 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. | +| touchable7+ | 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 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(deprecated) | 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.
**NOTE**
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. | +| isPrivacyMode7+ | 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(deprecated) | 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.
**NOTE**
This property is supported since API version 7 and deprecated since API version 9. | +| isTransparent7+ | 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. | +| id9+ | number | Yes | No | Window ID. The default value is **0**. The value must be an integer. | ## ColorSpace8+ @@ -259,12 +259,12 @@ Describes the scale parameters. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type| Readable| Writable| Description | -| ------ | -------- | ---- | ---- | -------------------------------------------------- | -| x | number | No | Yes | Scale factor along the x-axis. The default value is **1.0**. | -| y | number | No | Yes | Scale factor along the y-axis. 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**.| -| 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**.| +| Name | Type| Readable| Writable| Description | +| ------ | -------- | ---- | ---- |--------------------------------------------| +| 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 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 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 is a floating point number in the range [0.0, 1.0], and the default value is **0.5**.| ## RotateOptions9+ @@ -274,13 +274,13 @@ Describes the rotation parameters. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type| Readable| Writable| Description | -| ------ | -------- | ---- | ---- | -------------------------------------------------- | -| x | number | No | Yes | Rotation angle around the x-axis. The default value is **0.0**. | -| y | number | No | Yes | Rotation angle around the y-axis. The default value is **0.0**. | -| z | number | No | Yes | Rotation angle around the z-xis. 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**.| -| 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**.| +| Name | Type| Readable| Writable| Description | +| ------ | -------- | ---- | ---- |---------------------------------------------| +| 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 value is a floating point number, and 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 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 is a floating point number in the range [0.0, 1.0], and the default value is **0.5**. | ## TranslateOptions9+ @@ -292,9 +292,9 @@ Describes the translation parameters. | Name| Type| Readable| Writable| Description | | ---- | -------- | ---- | ---- | ---------------------------- | -| x | number | No | Yes | Distance to translate along the x-axis. The default value is **0.0**.| -| y | number | No | Yes | Distance to translate along the y-axis. The default value is **0.0**.| -| z | number | No | Yes | Distance to translate along the z-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 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 value is a floating point number, and the default value is **0.0**.| ## window.createWindow9+ @@ -519,7 +519,7 @@ Minimizes all windows on a display. This API uses an asynchronous callback to re | 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<void> | Yes | Callback used to return the result. | **Error codes** @@ -568,7 +568,7 @@ Minimizes all windows on a display. This API uses a promise to return the result | 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** @@ -1552,8 +1552,8 @@ This operation is not supported in a window in full-screen mode. | 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.| -| y | number | Yes| Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.| +| 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. The value must be an integer.| | callback | AsyncCallback<void> | Yes| Callback used to return the result. | **Error codes** @@ -1595,8 +1595,8 @@ This operation is not supported in a window in full-screen mode. | 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.| -| y | number | Yes| Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.| +| 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. The value must be an integer.| **Return value** @@ -1648,8 +1648,8 @@ This operation is not supported in a window in full-screen mode. | Name| Type| Mandatory| Description| | -------- | ------------------------- | -- | ------------------------ | -| width | number | Yes| New width of the window, in px.| -| height | number | Yes| New height 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. The value must be an integer.| | callback | AsyncCallback<void> | Yes| Callback used to return the result. | **Error codes** @@ -1697,8 +1697,8 @@ This operation is not supported in a window in full-screen mode. | Name| Type| Mandatory| Description| | ------ | ------ | -- | ------------------------ | -| width | number | Yes| New width of the window, in px.| -| height | number | Yes| New height 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. The value must be an integer.| **Return value** @@ -2575,10 +2575,10 @@ Enables listening for keyboard height changes. **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.| -| callback | Callback<number> | Yes | Callback used to return the current keyboard height. | +| callback | Callback<number> | Yes | Callback used to return the current keyboard height, which is an integer. | **Example** @@ -2605,7 +2605,7 @@ Disables listening for keyboard height changes. | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type. The value is fixed at **'keyboardHeightChange'**, indicating the keyboard height change event.| -| callback | Callback<number> | No | Callback used to return the current keyboard height. | +| callback | Callback<number> | No | Callback used to return the current keyboard height, which is an integer. | **Example** @@ -2661,7 +2661,7 @@ Disables listening for click events outside this window. | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type. The value is fixed at **'touchOutside'**, indicating the click event outside this window.| -| callback | Callback<number> | No | Callback used to return the click event outside this window. | +| callback | Callback<void> | No | Callback used to return the click event outside this window. | **Example** @@ -3097,10 +3097,10 @@ When the screen brightness setting for the window takes effect, Control Panel ca **Parameters** -| Name| Type| Mandatory| Description| -| ---------- | ------------------------- | -- | --------------------------------- | -| brightness | number | Yes| Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result. | +| Name| Type| Mandatory| Description | +| ---------- | ------------------------- | -- |-------------------------------------------| +| 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<void> | Yes| Callback used to return the result. | **Error codes** @@ -3140,9 +3140,9 @@ When the screen brightness setting for the window takes effect, Control Panel ca **Parameters** -| Name| Type| Mandatory| Description| -| ---------- | ------ | -- | --------------------------------- | -| brightness | number | Yes| Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| +| Name| Type| Mandatory| Description | +| ---------- | ------ | -- |----------------------------------------| +| 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** @@ -3760,9 +3760,9 @@ Sets the opacity for this window. This API can be used only when you [customize **Parameters** -| 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.| +| Name | Type | Mandatory| Description | +| ------- | ------ | ---- |----------------------------------------------------| +| 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** @@ -3980,9 +3980,9 @@ Blurs this window. **Parameters** -| 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.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- |--------------------------------------------------| +| 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** @@ -4015,9 +4015,9 @@ Blurs the background of this window. **Parameters** -| 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.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- |-------------------------------------------------------| +| 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** @@ -4085,12 +4085,12 @@ Sets the shadow for the window borders. **Parameters** -| 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.| +| Name | Type | Mandatory| Description | +| ------- | ------ | ---- |-------------------------------------------------------------| +| 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**.| -| offsetX | number | No | Offset of the shadow along the x-axis, in pixels. | -| offsetY | number | No | Offset of the shadow along the y-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. The value is a floating point number. | **Error codes** @@ -4123,9 +4123,9 @@ Sets the radius of the rounded corners for this window. **Parameters** -| 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.| +| Name | Type | Mandatory| Description | +| ----------- | ------- | ---- |----------------------------------------------------| +| 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** @@ -4282,8 +4282,8 @@ This operation is not supported in a window in full-screen mode. | 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.| -| y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.| +| 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. The value must be an integer.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Example** @@ -4316,8 +4316,8 @@ This operation is not supported in a window in full-screen mode. | 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.| -| y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.| +| 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. The value must be an integer.| **Return value** @@ -4360,8 +4360,8 @@ This operation is not supported in a window in full-screen mode. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------- | -| width | number | Yes | New width of the window, in px.| -| height | number | Yes | New height 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. The value must be an integer.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Example** @@ -4400,8 +4400,8 @@ This operation is not supported in a window in full-screen mode. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | -| width | number | Yes | New width of the window, in px.| -| height | number | Yes | New height 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. The value must be an integer.| **Return value** @@ -5350,10 +5350,10 @@ When the screen brightness setting for the window takes effect, Control Panel ca **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------------------------- | ---- | ------------------------------------ | -| brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| Name | Type | Mandatory| Description | +| ---------- | ------------------------- | ---- |---------------------------------------| +| 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<void> | Yes | Callback used to return the result. | **Example** @@ -5384,9 +5384,9 @@ When the screen brightness setting for the window takes effect, Control Panel ca **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | ------------------------------------ | -| brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| +| Name | Type | Mandatory| Description | +| ---------- | ------ | ---- |------------------------------------------| +| 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** @@ -5420,10 +5420,10 @@ Sets the dimness of the window that is not on top. This API uses an asynchronous **Parameters** -| 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.| -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| Name | Type | Mandatory| Description | +| -------------- | ------------------------- | ---- |----------------------------------------| +| 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<void> | Yes | Callback used to return the result. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-worker.md b/en/application-dev/reference/apis/js-apis-worker.md index c8910b3df624c6c6ebfab3816a1a21eadaebcc96..6d1bff42d490701f87940606d1ae4332b339b260 100644 --- a/en/application-dev/reference/apis/js-apis-worker.md +++ b/en/application-dev/reference/apis/js-apis-worker.md @@ -83,9 +83,9 @@ import worker from '@ohos.worker'; // Create a Worker instance. // 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. -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. const workerStageModel01 = new worker.ThreadWorker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"}); @@ -115,7 +115,7 @@ In the FA model: "buildOption": { "sourceOption": { "workers": [ - "./src/main/ets/MainAbility/workers/worker.ts" + "./src/main/ets/entryability/workers/worker.ts" ] } } @@ -161,9 +161,9 @@ In the stage model: ### postMessage9+ -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 @@ -171,8 +171,8 @@ Sends a message to the worker thread. The data type of the message must be seque | Name | Type | Mandatory| Description | | -------- | ------------- | ---- | ------------------------------------------------------------ | -| message | Object | Yes | Message to be sent to the worker thread. | -| transfer | ArrayBuffer[] | Yes | An **ArrayBuffer** object can be transferred. The value **null** should not be passed in the array.| +| 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** 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** @@ -181,7 +181,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | ID| Error Message | | -------- | ----------------------------------------- | | 10200004 | Worker instance is not running. | -| 10200006 | Serializing an uncaught exception failed. | +| 10200006 | An exception occurred during serialization. | **Example** @@ -196,7 +196,7 @@ workerInstance.postMessage(buffer, [buffer]); 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 @@ -204,8 +204,8 @@ Sends a message to the worker thread. The data type of the message must be seque | Name | Type | Mandatory| Description | | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | -| message | Object | Yes | Message to be sent to the worker thread. | -| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.| +| 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 | 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.
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** @@ -214,7 +214,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | ID| Error Message | | -------- | ----------------------------------------- | | 10200004 | Worker instance is not running. | -| 10200006 | Serializing an uncaught exception failed. | +| 10200006 | An exception occurred during serialization. | **Example** @@ -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. 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}); @@ -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. 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}); @@ -849,16 +849,16 @@ Implements communication between the worker thread and the host thread. The **po 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 **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------- | ---- | ------------------------------------------------------- | -| message | Object | Yes | Message to be sent to the host thread. | -| transfer | ArrayBuffer[] | Yes | An **ArrayBuffer** object can be transferred. The value **null** should not be passed in the array.| +| Name | Type | Mandatory| Description | +| -------- | ------------- | ---- | ------------------------------------------------------------ | +| 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 | **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** @@ -867,18 +867,18 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | ID| Error Message | | -------- | ----------------------------------------- | | 10200004 | Worker instance is not running. | -| 10200006 | Serializing an uncaught exception failed. | +| 10200006 | An exception occurred during serialization. | **Example** ```js -// main.js +// Main thread import worker from '@ohos.worker'; const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); workerInstance.onmessage = function(e) { // 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){ 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 @@ -905,8 +905,8 @@ Sends a message to the host thread from the worker thread. | Name | Type | Mandatory| Description | | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | -| message | Object | Yes | Message to be sent to the host thread. | -| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.| +| 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 | 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.
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** @@ -915,18 +915,18 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | ID| Error Message | | -------- | ----------------------------------------- | | 10200004 | Worker instance is not running. | -| 10200006 | Serializing an uncaught exception failed. | +| 10200006 | An exception occurred during serialization. | **Example** ```js -// main.js +// Main thread import worker from '@ohos.worker'; const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); workerInstance.onmessage = function(e) { // 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'; const workerPort = worker.workerPort; workerPort.onmessage = function(e){ // 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 **Example** ```js -// main.js +// Main thread import worker from '@ohos.worker'; 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 **Example** ```js -// main.js +// Main thread import worker from '@ohos.worker'; const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); @@ -1013,7 +1013,7 @@ workerInstance.postMessage("hello world"); import worker from '@ohos.worker'; const workerPort = worker.workerPort; 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 **Example** ```js -// main.js +// Main thread import worker from '@ohos.worker'; 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'; const parentPort = worker.workerPort; 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 **Example** ```js -// main.js +// Main thread import worker from '@ohos.worker'; 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'; const workerPort = worker.workerPort workerPort.onerror = function(e){ - console.log("worker.js onerror") + console.log("worker.ts onerror") } ``` @@ -1193,9 +1193,9 @@ import worker from '@ohos.worker'; // Create a Worker instance. // 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. -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. const workerStageModel01 = new worker.Worker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"}); @@ -1216,7 +1216,7 @@ In the FA model: "buildOption": { "sourceOption": { "workers": [ - "./src/main/ets/MainAbility/workers/worker.ts" + "./src/main/ets/entryability/workers/worker.ts" ] } } @@ -1256,9 +1256,9 @@ In the stage model: ### postMessage(deprecated) -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**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorker.postMessage9+](#postmessage9) instead. @@ -1267,15 +1267,15 @@ Sends a message to the worker thread. The data type of the message must be seque **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------- | ---- | ----------------------------------------------- | -| message | Object | Yes | Message to be sent to the worker thread. | -| transfer | ArrayBuffer[] | Yes | **ArrayBuffer** instances that can be transferred.| +| Name | Type | Mandatory| Description | +| -------- | ------------- | ---- | ------------------------------------------------------------ | +| 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** 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** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); var buffer = new ArrayBuffer(8); workerInstance.postMessage(buffer, [buffer]); @@ -1285,7 +1285,7 @@ workerInstance.postMessage(buffer, [buffer]); 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**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorker.postMessage9+](#postmessage9-1) instead. @@ -1296,13 +1296,13 @@ Sends a message to the worker thread. The data type of the message must be seque | Name | Type | Mandatory| Description | | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | -| message | Object | Yes | Message to be sent to the worker thread. | -| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.| +| 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 | 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.
If this parameter is not specified, the default value **undefined** is used, and information is transferred to the worker thread by copying data.| **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.postMessage("hello world"); @@ -1332,7 +1332,7 @@ Adds an event listener for the worker thread. This API provides the same functio **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.on("alert", (e)=>{ console.log("alert listener callback"); }) @@ -1360,7 +1360,7 @@ Adds an event listener for the worker thread and removes the event listener afte **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.once("alert", (e)=>{ console.log("alert listener callback"); }) @@ -1388,7 +1388,7 @@ Removes an event listener for the worker thread. This API provides the same func **Example** ```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. workerInstance.off("alert"); ``` @@ -1408,7 +1408,7 @@ Terminates the worker thread to stop it from receiving messages. **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.terminate(); ``` @@ -1433,7 +1433,7 @@ Defines the event handler to be called when the worker thread exits. The handler **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.onexit = function(e) { console.log("onexit"); } @@ -1467,7 +1467,7 @@ Defines the event handler to be called when an exception occurs during worker ex **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.onerror = function(e) { console.log("onerror"); } @@ -1489,12 +1489,12 @@ Defines the event handler to be called when the host thread receives a message s | Name| Type | Mandatory| Description | | ------ | ------------------------------ | ---- | ---------------------- | -| event | [MessageEvent](#messageeventt) | Yes | Message received.| +| event | [MessageEvent](#messageeventt)| Yes | Message received.| **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.onmessage = function(e) { // e: MessageEvent. The usage is as follows: // let data = e.data; @@ -1518,12 +1518,12 @@ Defines the event handler to be called when the worker thread receives a message | Name| Type | Mandatory| Description | | ------ | ------------------------------ | ---- | ---------- | -| event | [MessageEvent](#messageeventt) | Yes | Error data.| +| event | [MessageEvent](#messageeventt)| Yes | Error data.| **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.onmessageerror= function(e) { console.log("onmessageerror"); } @@ -1555,7 +1555,7 @@ Adds an event listener for the worker thread. This API provides the same functio **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -1583,7 +1583,7 @@ Removes an event listener for the worker thread. This API provides the same func **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -1617,7 +1617,7 @@ Dispatches the event defined for the worker thread. **Example** ```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. ``` @@ -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: ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); // Usage 1: workerInstance.on("alert_on", (e)=>{ @@ -1677,7 +1677,7 @@ Removes all event listeners for the worker thread. **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -1696,7 +1696,7 @@ Implements communication between the worker thread and the host thread. The **po 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**
> This API is deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope9+.postMessage9+](#postmessage9-2). @@ -1707,14 +1707,14 @@ Sends a message to the host thread from the worker thread. | 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. | ### postMessage9+ 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** > @@ -1724,25 +1724,25 @@ Sends a message to the host thread from the worker thread. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------- | ---- | ----------------------------------------------------- | -| message | Object | Yes | Message to be sent to the host thread. | -| transfer | ArrayBuffer[] | Yes | An **ArrayBuffer** object can be transferred. The value **null** should not be passed in the array.| +| Name | Type | Mandatory| Description | +| -------- | ------------- | ---- | ------------------------------------------------------------ | +| 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 | **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** ```js -// main.js +// Main thread 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.onmessage = function(e) { // let data = e.data; - console.log("receive data from worker.js"); + console.log("receive data from worker.ts"); } ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const parentPort = worker.parentPort; parentPort.onmessage = function(e){ @@ -1756,7 +1756,7 @@ parentPort.onmessage = function(e){ 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**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [ThreadWorkerGlobalScope9+.postMessage9+](#postmessage9-3). @@ -1767,28 +1767,28 @@ Sends a message to the host thread from the worker thread. | Name | Type | Mandatory| Description | | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | -| message | Object | Yes | Message to be sent to the host thread. | -| options | [PostMessageOptions](#postmessageoptions) | No | **ArrayBuffer** instances that can be transferred. The default value is **undefined**.| +| 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 | 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.
If this parameter is not specified, the default value **undefined** is used, and information is transferred to the host thread by copying data.| **Example** ```js -// main.js +// Main thread 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.onmessage = function(e) { // let data = e.data; - console.log("receive data from worker.js"); + console.log("receive data from worker.ts"); } ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const parentPort = worker.parentPort; parentPort.onmessage = function(e){ // 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. **Example** ```js -// main.js +// Main thread import worker from '@ohos.worker'; -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const parentPort = worker.parentPort; parentPort.onmessage = function(e) { @@ -1836,22 +1836,22 @@ Defines the event handler to be called when the worker thread receives a message | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------------------ | ---- | ------------------------ | | this | [DedicatedWorkerGlobalScope](#dedicatedworkerglobalscopedeprecated) | Yes | Caller. | -| ev | [MessageEvent](#messageeventt) | Yes | Message received.| +| ev | [MessageEvent](#messageeventt) | Yes | Message received.| **Example** ```js -// main.js +// Main thread 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"); ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const parentPort = worker.parentPort; 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 | Name| Type | Mandatory| Description | | ------ | ------------------------------ | ---- | ---------- | | this | [DedicatedWorkerGlobalScope](#dedicatedworkerglobalscopedeprecated) | Yes | Caller.| -| ev | [MessageEvent](#messageeventt) | Yes | Error data.| +| ev | [MessageEvent](#messageeventt)| Yes | Error data.| **Example** ```js -// main.js +// Main thread import worker from '@ohos.worker'; -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const parentPort = worker.parentPort; parentPort.onmessageerror = function(e) { - console.log("worker.js onmessageerror") + console.log("worker.ts onmessageerror") } ``` ## 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 @@ -1940,7 +1940,7 @@ Implements event listening. **Example** ```js -const workerInstance = new worker.Worker("workers/worker.js"); +const workerInstance = new worker.Worker("workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -2010,16 +2010,16 @@ Defines the event handler to be called when an exception occurs during worker ex **Example** ```js -// main.js +// Main thread import worker from '@ohos.worker'; -const workerInstance = new worker.Worker("workers/worker.js") +const workerInstance = new worker.Worker("workers/worker.ts") ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const parentPort = worker.parentPort 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 > An FA project of API version 9 is used as an example. ```js -// main.js +// Main thread import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); -workerInstance.postMessage("message from main to worker"); +const workerInstance = new worker.ThreadWorker("workers/worker.ts"); +workerInstance.postMessage("message from main thread to worker"); workerInstance.onmessage = function(d) { // When the worker thread passes obj2, data contains obj2, excluding the Init or SetName method. let data = d.data; } ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort; class MyModel { @@ -2065,7 +2065,7 @@ class MyModel { } } workerPort.onmessage = function(d) { - console.log("worker.js onmessage"); + console.log("worker.ts onmessage"); let data = d.data; let func1 = function() { console.log("post message is function"); @@ -2083,27 +2083,28 @@ workerPort.onmessage = function(d) { workerPort.postMessage(obj2); // No serialization error occurs when passing obj2. } workerPort.onmessageerror = function(e) { - console.log("worker.js onmessageerror"); + console.log("worker.ts onmessageerror"); } workerPort.onerror = function(e) { - console.log("worker.js onerror"); + console.log("worker.ts onerror"); } ``` ### 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. ### 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. -- 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. - 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. - 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. +- A maximum of 16 MB data can be transferred during inter-thread communication. ## Sample Code > **NOTE**
@@ -2111,15 +2112,10 @@ Each actor concurrently processes tasks of the main thread. For each actor, ther ### FA Model ```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'; // Create a Worker instance in the main thread. 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. workerInstance.postMessage("123"); @@ -2128,7 +2124,7 @@ workerInstance.postMessage("123"); workerInstance.onmessage = function(e) { // data carries the information sent by the worker thread. let data = e.data; - console.log("main.js onmessage"); + console.log("main thread onmessage"); // Terminate the Worker instance. workerInstance.terminate(); @@ -2136,7 +2132,7 @@ workerInstance.onmessage = function(e) { // Call onexit(). workerInstance.onexit = function() { - console.log("main.js terminate"); + console.log("main thread terminate"); } ``` ```js @@ -2146,9 +2142,6 @@ import worker from '@ohos.worker'; // Create an object in the worker thread for communicating with the main thread. 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. workerPort.onmessage = function(e) { // data carries the information sent by the main thread. @@ -2169,20 +2162,18 @@ Configuration of the **build-profile.json5** file: "buildOption": { "sourceOption": { "workers": [ - "./src/main/ets/MainAbility/workers/worker.ts" + "./src/main/ets/entryability/workers/worker.ts" ] } } ``` ### Stage Model ```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'; // Create a Worker instance in the main thread. 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. workerInstance.postMessage("123"); @@ -2191,14 +2182,14 @@ workerInstance.postMessage("123"); workerInstance.onmessage = function(e) { // data carries the information sent by the worker thread. let data = e.data; - console.log("main.js onmessage"); + console.log("main thread onmessage"); // Terminate the Worker instance. workerInstance.terminate(); } // Call onexit(). workerInstance.onexit = function() { - console.log("main.js terminate"); + console.log("main thread terminate"); } ``` ```js diff --git a/en/application-dev/reference/arkui-ts/Readme-EN.md b/en/application-dev/reference/arkui-ts/Readme-EN.md index c886d22cc739bcbc3462da7c70be338496308cd7..4e671121c98951699808e94f506fd75b9dc00e09 100644 --- a/en/application-dev/reference/arkui-ts/Readme-EN.md +++ b/en/application-dev/reference/arkui-ts/Readme-EN.md @@ -33,7 +33,6 @@ - [Gradient Color](ts-universal-attributes-gradient-color.md) - [Popup Control](ts-universal-attributes-popup.md) - [Menu Control](ts-universal-attributes-menu.md) - - [Click Control](ts-universal-attributes-click.md) - [Focus Control](ts-universal-attributes-focus.md) - [Hover Effect](ts-universal-attributes-hover-effect.md) - [Component ID](ts-universal-attributes-component-id.md) @@ -168,3 +167,5 @@ - [Types](ts-types.md) - Components No Longer Maintained - [GridContainer](ts-container-gridcontainer.md) +- APIs No Longer Maintained + - [Click Control](ts-universal-attributes-click.md) \ No newline at end of file diff --git a/en/application-dev/reference/arkui-ts/figures/tabContent1.gif b/en/application-dev/reference/arkui-ts/figures/tabContent1.gif index 4a278ae098837a2d809b600dcd621ecf83085ede..6f46fd6ea2436eb91bcf5c3fe1637760e6331d4e 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/tabContent1.gif and b/en/application-dev/reference/arkui-ts/figures/tabContent1.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/tabContent2.gif b/en/application-dev/reference/arkui-ts/figures/tabContent2.gif index b88d171c0dcf285a40833b9cc73056def5fe3f8b..9b09ae6841648ed717309fa5912e4a7e6cb54cf2 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/tabContent2.gif and b/en/application-dev/reference/arkui-ts/figures/tabContent2.gif differ diff --git a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md index 403bce55ad683f76315967c1c563c044d324631b..00095beb0f5a5739de8a9ab62da63a1807e475c5 100644 --- a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md +++ b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md @@ -14,14 +14,18 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Type | Mandatory | Description | | ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ | -| duration | number | No | Animation duration, in ms.
Default value: **1000**
Unit: ms
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
- The maximum animation duration on an ArkTS widget is 1000 ms.
- 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.| -| tempo | number | No | Animation playback speed. A larger value indicates a higher animation playback speed.
The value **0** indicates that no animation is applied.
Default value: **1**
**NOTE**
A value less than 1 evaluates to the value **1**.| +| duration | number | No | Animation duration, in ms.
Default value: **1000**
Unit: ms
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
- The maximum animation duration on an ArkTS widget is 1000 ms.
- A value less than 0 evaluates to the value **0**.
- 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.
The value **0** indicates that no animation is applied.
Default value: **1**
**NOTE**
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)9+ | No | Animation curve. The default curve is linear.
Default value: **Curve.Linear**
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.
Default value: **0**
Value range: [0, +∞)
**NOTE**
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.
Default value: **0**
Value range: [0, +∞)
**NOTE**
- A value less than 0 evaluates to the value **0**.
- 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.
Default value: **1**
Value range: [-1, +∞)
**NOTE**
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.
Default value: **PlayMode.Normal**
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.
Default value: **PlayMode.Normal**
Since API version 9, this API is supported in ArkTS widgets.
For details about the restrictions, see **Notes about PlayMode**.| | onFinish | () => void | No | Callback invoked when the animation playback is complete.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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 diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md index 55fc4778a2aa43a7dc298093f9000ce3f62d822b..23e0ccef1139f968965c39ee1d696661279d4cc3 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md @@ -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.
For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxLines**, or layout constraint settings.
Since API version 9, this API is supported in ArkTS widgets. | | maxFontSize | number \| string \| [Resource](ts-types.md#resource) | Maximum font size.
For the setting to take effect, this attribute must be used together with **minFontSize**, **maxLines**, or layout constraint settings.
Since API version 9, this API is supported in ArkTS widgets. | | textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.
Default value: **TextCase.Normal**
Since API version 9, this API is supported in ArkTS widgets.| -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
Default value: **CopyOptions.None**
This API is supported in ArkTS widgets.| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
Default value: **CopyOptions.None**
This API is supported in ArkTS widgets.
**NOTE**
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** > diff --git a/en/application-dev/reference/arkui-ts/ts-container-stack.md b/en/application-dev/reference/arkui-ts/ts-container-stack.md index 0bfa204dd223123bd5a1ef98cfc45eb1136b42b8..fb8b772e1eaaa265d15b9a38140ff77e7d629577 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-stack.md +++ b/en/application-dev/reference/arkui-ts/ts-container-stack.md @@ -30,7 +30,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | ------------ | ------------------------------------------- | ------------------------------------------------------------ | -| alignContent | [Alignment](ts-appendix-enums.md#alignment) | Alignment of child components in the container.
Default value: **Alignment.Center**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Default value: **Alignment.Center**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
When both this attribute and the universal attribute [align](ts-universal-attributes-location.md) are set, whichever is set last takes effect.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-container-swiper.md b/en/application-dev/reference/arkui-ts/ts-container-swiper.md index d5df61c6316ba122bb8d4bcb05032828310b0e7a..bda431d14687d6be5e36c5eacb429f6b192e3120 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-swiper.md +++ b/en/application-dev/reference/arkui-ts/ts-container-swiper.md @@ -14,6 +14,10 @@ This component can contain child components. > **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. +> +> When the **\** 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 @@ -42,11 +46,11 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | vertical | boolean | Whether vertical swiping is used.
Default value: **false** | | itemSpace | number \| string | Space between child components.
Default value: **0**
**NOTE**
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.
Default value: **SwiperDisplayMode.Stretch**| -| cachedCount8+ | number | Number of child components to be cached.
Default value: **1**
**NOTE**
**cachedCount** has caching optimized. You are advised not to use it together with [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md).| +| cachedCount8+ | number | Number of child components to be cached.
Default value: **1**
**NOTE**
This attribute applies only when the **\** component uses [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md).| | disableSwipe8+ | boolean | Whether to disable the swipe feature.
Default value: **false** | | curve8+ | [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.
Default value: **Curve.Linear**| | indicatorStyle8+ | {
left?: [Length](ts-types.md#length),
top?: [Length](ts-types.md#length),
right?: [Length](ts-types.md#length),
bottom?: [Length](ts-types.md#length),
size?: [Length](ts-types.md#length),
mask?: boolean,
color?: [ResourceColor](ts-types.md),
selectedColor?: [ResourceColor](ts-types.md)
} | Style of the navigation point indicator.
\- **left**: distance between the navigation point indicator and the left edge of the **\** component.
\- **top**: distance between the navigation point indicator and the top edge of the **\** component.
\- **right**: distance between the navigation point indicator and the right edge of the **\** component.
\- **bottom**: distance between the navigation point indicator and the bottom edge of the **\** component.
\- **size**: diameter of the navigation point indicator. The value cannot be in percentage. Default value: **6vp**
\- **mask**: whether to enable the mask for the navigation point indicator.
\- **color**: color of the navigation point indicator.
\- **selectedColor**: color of the selected navigation dot.| -| displayCount8+ | number \| string | Number of elements to display per page.
Default value: **1**
**NOTE**
If the value is of the string type, it can only be **'auto'**, whose display effect is the same as that of **SwiperDisplayMode.AutoLinear**.
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.| +| displayCount8+ | number \| string | Number of elements to display per page.
Default value: **1**
**NOTE**
If the value is of the string type, it can only be **'auto'**, whose display effect is the same as that of **SwiperDisplayMode.AutoLinear**.
If the value is set to a number less than or equal to 0, the default value **1** is used.
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.| | effectMode8+ | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Swipe effect. For details, see **EdgeEffect**.
Default value: **EdgeEffect.Spring**
**NOTE**
The spring effect does not take effect when the controller API is called.| ## SwiperDisplayMode diff --git a/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md b/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md index 34f2591ee877919152d8f502c916d78ef450154e..9b1bb12bf3d7c0b4f07b22a0c5cbf5a6b542e2e4 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md +++ b/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md @@ -27,7 +27,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| tabBar | string \| Resource \| {
icon?: string \| Resource,
text?: string \| Resource
}
\| [CustomBuilder](ts-types.md)8+ | Content displayed on the tab bar.
**CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions).
**NOTE**
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.
If the content set exceeds the space provided by the tab bar, it will be clipped.| +| tabBar | string \| [Resource](ts-types.md#resource) \| {
icon?: string \| [Resource](ts-types.md#resource),
text?: string \| [Resource](ts-types.md#resource)
}
\| [CustomBuilder](ts-types.md)8+ | Content displayed on the tab bar.
**CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions).
**NOTE**
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.
If the content set exceeds the space provided by the tab bar, it will be clipped.| | tabBar9+ | [SubTabBarStyle](#subtabbarstyle9) \| [BottomTabBarStyle](#bottomtabbarstyle9) | Content displayed on the tab bar.
**SubTabBarStyle**: subtab style. It takes text as its input parameter.
**BottomTabBarStyle**: bottom and side tab style. It takes text and images as its input parameters.
**NOTE**
The bottom tab style does not include an underline.
When an icon display error occurs, a gray blank block is displayed.| > **NOTE** diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md index 47c8c41f78db5961fb831835c0b73fd8b91e129e..9adcb73285ee60ea5ab75832b6c7e404e8e523e2 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md @@ -22,8 +22,8 @@ Since API version 9, this API is supported in ArkTS widgets. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| width | string \| number | No| Width of the circle.
Default value: **0**| -| height | string \| number | No| Height of the circle.
Default value: **0**| +| width | string \| number | No| Width of the circle.
Default value: **0**
**NOTE**
An invalid value is handled as the default value.| +| height | string \| number | No| Height of the circle.
Default value: **0**
**NOTE**
An invalid value is handled as the default value.| ## Attributes @@ -31,19 +31,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| fill | [ResourceColor](ts-types.md) | Color of the fill area.
Default value: **Color.Black**
Since API version 9, this API is supported in ArkTS widgets.| -| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| Opacity of the fill area.
Default value: **1**
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashArray | Array<Length> | Stroke dashes.
Default value: **[]**
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashOffset | number \| string | Offset of the start point for drawing the stroke.
Default value: **0**
Since API version 9, this API is supported in ArkTS widgets.| +| fill | [ResourceColor](ts-types.md) | Color of the fill area.
Default value: **Color.Black**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| Opacity of the fill area.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If the value is invalid, no stroke will be drawn.| +| strokeDashArray | Array<Length> | Stroke dashes.
Default value: **[]**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| strokeDashOffset | number \| string | Offset of the start point for drawing the stroke.
Default value: **0**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the stroke.
Default value: **LineCapStyle.Butt**
Since API version 9, this API is supported in ArkTS widgets.| -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | Join style of the stroke.
Default value: **LineJoinStyle.Miter**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not work for the **\** component, which does not have corners.| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | Join style of the stroke.
Default value: **LineJoinStyle.Miter**
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.
Default value: **4**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect for the **\** component, because it does not have a miter join.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| Stroke opacity.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.| -| strokeWidth | Length | Stroke width.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| Stroke opacity.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.
An invalid value is handled as the default value.| | antiAlias | boolean | Whether anti-aliasing is enabled.
Default value: **true**
Since API version 9, this API is supported in ArkTS widgets.| + ## Example ```ts diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md index 95d6e04adb6cdac5a36d57cc6013c3eb98434491..210728ef5116708567ce98e41db1d08ae228d88e 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md @@ -22,8 +22,10 @@ Since API version 9, this API is supported in ArkTS widgets. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| width | string \| number | No| Width.
Default value: **0**| -| height | string \| number | No| Height.
Default value: **0**| +| width | string \| number | No| Width.
Default value: **0**
**NOTE**
An invalid value is handled as the default value.| +| height | string \| number | No| Height.
Default value: **0**
**NOTE**
An invalid value is handled as the default value.| + + ## Attributes @@ -31,19 +33,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
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.
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If the value is invalid, no stroke will be drawn.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not work for the **\** 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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect for the **\** component, because it does not have a miter join.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.| -| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.
An invalid value is handled as the default value.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| + ## Example ```ts diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md index f17d6856796e158066f4cbe1e20e046fa8d562ff..258fafdf9b7bbb003be35567cbf4aefbfd30f27d 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md @@ -21,8 +21,9 @@ Since API version 9, this API is supported in ArkTS widgets. | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | -| width | string \| number | No| 0 | Width.| -| height | string \| number | No| 0 | Height.| +| width | string \| number | No| 0 | Width.
**NOTE**
An invalid value is handled as the default value.| +| height | string \| number | No| 0 | Height.
**NOTE**
An invalid value is handled as the default value.| + ## Attributes @@ -31,20 +32,22 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| startPoint | Array<Length> | [0, 0] | Coordinates (relative coordinates) of the start point of the line, in vp.
Since API version 9, this API is supported in ArkTS widgets.| -| endPoint | Array<Length> | [0, 0] | Coordinates (relative coordinates) of the end point of the line, in vp.
Since API version 9, this API is supported in ArkTS widgets.| +| startPoint | Array<Length> | [0, 0] | Coordinates (relative coordinates) of the start point of the line, in vp.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| endPoint | Array<Length> | [0, 0] | Coordinates (relative coordinates) of the end point of the line, in vp.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| | fill | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect because the **\** component cannot be used to draw a closed shape.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect because the **\** 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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If the value is invalid, no stroke will be drawn.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not work for the **\** component, which does not have corners.| | strokeMiterLimit | number \| string | 4 | Limit value when the sharp angle is drawn as a miter.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect because the **\** component cannot be used to draw a shape with a sharp angle.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.| -| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.
An invalid value is handled as the default value.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| + + ## Example ### Example 1 diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md index 25ba06a014b013ed97219d21cca40cca8f8e90c3..5cb272b6f3d39ac9394ff3e60384a9c41f8a50fc 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md @@ -19,11 +19,13 @@ Since API version 9, this API is supported in ArkTS widgets. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ---------------- | ---- | ----------------------------------- | -| width | number \| string | No | Width of the rectangle where the path is located.
Default value: **0** | -| height | number \| string | No | Height of the rectangle where the path is located.
Default value: **0** | -| commands | string | No | Command for drawing the path.
Default value: **''**| +| Name | Type | Mandatory| Description | +| -------- | ---------------- | ---- | ------------------------------------------------------------ | +| width | number \| string | No | Width of the rectangle where the path is located.
Default value: **0**
**NOTE**
An invalid value is handled as the default value.| +| height | number \| string | No | Height of the rectangle where the path is located.
Default value: **0**
**NOTE**
An invalid value is handled as the default value.| +| commands | string | No | Command for drawing the path.
Default value: **''**
**NOTE**
An invalid value is handled as the default value.| + + ## Attributes @@ -31,17 +33,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | 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).
Since API version 9, this API is supported in ArkTS widgets.| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
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.
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
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).
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If the value is invalid, no stroke will be drawn.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
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.
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.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the stroke.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeWidth | Length | 1 | Width of the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| 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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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 | Opacity of the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.
An invalid value is handled as the default value.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| The supported commands are as follows: diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md index 8a0450ff17a692d98170a9dca96d7acb65250660..eda62dee5b2e3e5e5d50ddc2e42d1ae2944b8b93 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md @@ -22,8 +22,9 @@ Since API version 9, this API is supported in ArkTS widgets. | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | -| width | string \| number | No| 0 | Width.| -| height | string \| number | No| 0 | Height.| +| width | string \| number | No| 0 | Width.
**NOTE**
An invalid value is handled as the default value.| +| height | string \| number | No| 0 | Height.
**NOTE**
An invalid value is handled as the default value.| + ## Attributes @@ -32,17 +33,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| points | Array<Point> | [] | Vertex coordinates of the polygon.
Since API version 9, this API is supported in ArkTS widgets.| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
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.
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| points | Array<Point> | [] | Vertex coordinates of the polygon.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If the value is invalid, no stroke will be drawn.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
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.
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.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| 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.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
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**.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.
An invalid value is handled as the default value.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| ## Point diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md index 6681e790aeb02e3bcfb706cf0162e9c0376e7906..a8cf8ca7ccfef77b5a17e7e4326fabfc49ba1506 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md @@ -22,8 +22,9 @@ Since API version 9, this API is supported in ArkTS widgets. | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | -| width | string \| number | No| 0 | Width.| -| height | string \| number | No| 0 | Height.| +| width | string \| number | No| 0 | Width.
**NOTE**
An invalid value is handled as the default value.| +| height | string \| number | No| 0 | Height.
**NOTE**
An invalid value is handled as the default value.| + ## Attributes @@ -32,18 +33,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| points | Array<Point> | [] | List of coordinates that the polyline passes through.
Since API version 9, this API is supported in ArkTS widgets.| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
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.
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| points | Array<Point> | [] | List of coordinates that the polyline passes through.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If the value is invalid, no stroke will be drawn.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
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.
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.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| -| antiAlias | boolean | true | Whether anti-aliasing is enabled.
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.
An invalid value is handled as the default value.| +| antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| + + ## Point diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md index c7fac4fa35067c4e9be6e6e7aca05f0d7e25bdb1..879805a6635cb0decefa842036bae5b2c88ba896 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md @@ -23,12 +23,11 @@ Since API version 9, this API is supported in ArkTS widgets. | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | -| width | string \| number | No| 0 | Width.| -| height | string \| number | No| 0 | Height.| -| radius | string \| number \| Array<string \| number> | No| 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.| -| radiusWidth | string \| number | No| 0 | Width of the rounded corner.| -| radiusHeight | string \| number | No| 0 | Height of the rounded corner.| - +| width | string \| number | No| 0 | Width.
**NOTE**
An invalid value is handled as the default value.| +| height | string \| number | No| 0 | Height.
**NOTE**
An invalid value is handled as the default value.| +| radius | string \| number \| Array<string \| number> | No| 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.
This attribute works in a similar manner as **radiusWidth**/**radiusHeight**. When they are used together, it takes precedence over **radiusWidth**/**radiusHeight**.
**NOTE**
An invalid value is handled as the default value.| +| radiusWidth | string \| number | No| 0 | Width of the rounded corner.
**NOTE**
An invalid value is handled as the default value.| +| radiusHeight | string \| number | No| 0 | Height of the rounded corner.
**NOTE**
An invalid value is handled as the default value.| ## Attributes @@ -36,21 +35,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | 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.
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.
Since API version 9, this API is supported in ArkTS widgets.| -| radius | string \| number \| Array<string \| number> | 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.
Since API version 9, this API is supported in ArkTS widgets.| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
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.
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| radius | string \| number \| Array<string \| number> | 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If the value is invalid, no stroke will be drawn.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
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.
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.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| -| antiAlias | boolean | true | Whether anti-aliasing is enabled.
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.
An invalid value is handled as the default value.| +| antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md index c1d54675e22bf4d55b17ccde9727b318c028186f..c9506bbbf823f263f8675fc0329eb5d51f5f2f0c 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md @@ -2,7 +2,6 @@ The **\** 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 **\** as their parent to implement the effect similar to SVG. 2. The **\** 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 | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| viewPort | {
x?: number \| string,
y?: number \| string,
width?: number \| string,
height?: number \| string
} | { x:0, y:0, width:0, height:0 } | View port of the shape.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If of the string type, the value cannot be a percentage.| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
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.
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| viewPort | {
x?: number \| string,
y?: number \| string,
width?: number \| string,
height?: number \| string
} | { x:0, y:0, width:0, height:0 } | View port of the shape.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If of the string type, the value cannot be a percentage.
An invalid value is handled as the default value.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If the value is invalid, no stroke will be drawn.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
An invalid value is handled as the default value.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
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.
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.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeWidth | number \| string | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If of the string type, the value cannot be a percentage.| +| 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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If of the string type, the value cannot be a percentage.
An invalid value is handled as the default value.| | antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| | mesh8+ | Array<number>,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.
Since API version 9, this API is supported in ArkTS widgets.| diff --git a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md index 3e756f519e74b7f851b3af2401e7272eb133a4a9..cbc04498d8233ee5fac3f7cef621efe885388131 100644 --- a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md @@ -19,14 +19,18 @@ Since API version 9, this API is supported in ArkTS widgets. | Name| Type| Description| | -------- | -------- | -------- | -| duration | number | Animation duration, in ms.
Default value: **1000**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
- The maximum animation duration on an ArkTS widget is 1000 ms. If the set value exceeds the limit, the value **1000** 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.
Default value: **1.0**| +| duration | number | Animation duration, in ms.
Default value: **1000**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
- The maximum animation duration on an ArkTS widget is 1000 ms. If the set value exceeds the limit, the value **1000** will be used.
- A value less than 0 evaluates to the value **0**.
- 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.
Default value: **1.0**
**NOTE**
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.
Default value: **Curve.Linear**
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.
Default value: **0**| +| delay | number | Delay of animation playback, in ms. By default, the playback is not delayed.
Default value: **0**
**NOTE**
- A value less than 0 evaluates to the value **0**.
- 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.
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.
Default value: **PlayMode.Normal**
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.
Default value: **PlayMode.Normal**
Since API version 9, this API is supported in ArkTS widgets.
For details about the restrictions, see **Notes about PlayMode**.| | onFinish | () => void | Callback invoked when the animation playback is complete.
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 diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-click.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-click.md index f6ed907ac1dc0941cc422e262298359a52257b45..5b83363ed4374806ef0f4daca3db716ce1d22e91 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-click.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-click.md @@ -12,7 +12,7 @@ Click control attributes are used to set whether a component can respond to fing | Name | Type| Description | | ----------- | -------- | ------------------------ | -| touchable | boolean | Whether the component can respond to finger interactions such as click and touch events.
Default value: **true**| +| touchable(deprecated) | boolean | Whether the component can respond to finger interactions such as click and touch events.
Default value: **true**
**NOTE**
This API is deprecated since API version 9. You are advised to use [hitTestBehavior](ts-universal-attributes-hit-test-behavior.md) instead.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md index 76855375443264f0e2552db2b0df1fd339d8a53b..3ed88228f7e2ab9f68b61479f027f03b6b26c4cd 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md @@ -55,7 +55,7 @@ struct AspectRatioExample { Text(item) .backgroundColor(0xbbb2cb) .fontSize(40) - .height(160) + .width('100%') .aspectRatio(1.5) } }, item => item) @@ -70,10 +70,12 @@ struct AspectRatioExample { } ``` -**Figure 1** Portrait display
+**Figure 1** Portrait display + ![en-us_image_0000001256978379](figures/en-us_image_0000001256978379.gif) -**Figure 2** Landscape display
+**Figure 2** Landscape display + ![en-us_image_0000001212218476](figures/en-us_image_0000001212218476.gif) ```ts @@ -133,4 +135,6 @@ struct DisplayPriorityExample { ``` +Landscape display in containers of different sizes + ![en-us_image_0000001212058504](figures/en-us_image_0000001212058504.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md index 208a439b20a26388f719f00fc0690cd292071098..6805e5471e16379790c0b7ae749c6f6369369e2b 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md @@ -12,7 +12,7 @@ You can bind a popup to a component, specifying its content, interaction logic, | Name | Type | Description | | --------- | ---------------------------------------- | ---------------------------------------- | -| bindPopup | show: boolean,
popup: [PopupOptions](#popupoptions) \| [CustomPopupOptions](#custompopupoptions8)8+ | Binds a popup to the component.
**show**: whether to show the popup. The default value is **false**, indicating that the popup is hidden.
**popup**: parameters of the popup.| +| bindPopup | show: boolean,
popup: [PopupOptions](#popupoptions) \| [CustomPopupOptions](#custompopupoptions8)8+ | Binds a popup to the component.
**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.
**popup**: parameters of the popup.| ## PopupOptions diff --git a/en/application-dev/reference/errorcodes/Readme-EN.md b/en/application-dev/reference/errorcodes/Readme-EN.md index 789d602a1c02fb349f1461101102ac7ac34ff15a..7f4ba92a036d816de403527ccdf01dad5b4b9351 100644 --- a/en/application-dev/reference/errorcodes/Readme-EN.md +++ b/en/application-dev/reference/errorcodes/Readme-EN.md @@ -59,6 +59,7 @@ - [NFC Error Codes](errorcode-nfc.md) - [RPC Error Codes](errorcode-rpc.md) - [Bluetooth Error Codes](errorcode-bluetoothManager.md) + - [Wi-Fi Error Codes](errorcode-wifi.md) - Basic Features - [Accessibility Error Codes](errorcode-accessibility.md) - [FaultLogger Error Codes](errorcode-faultlogger.md) diff --git a/en/application-dev/reference/errorcodes/errorcode-ability.md b/en/application-dev/reference/errorcodes/errorcode-ability.md index a546cf466befbe2f76ddc62aea04d75331640818..ed669a20f5c89ae19d8a3123d8e78633543a4dd4 100644 --- a/en/application-dev/reference/errorcodes/errorcode-ability.md +++ b/en/application-dev/reference/errorcodes/errorcode-ability.md @@ -220,7 +220,7 @@ Common kernel errors such as memory application and multi-thread processing erro **Solution** -Ensure sufficient sytem memory. +Ensure sufficient system memory. ## 16000051 Network Error diff --git a/en/application-dev/reference/errorcodes/errorcode-wifi.md b/en/application-dev/reference/errorcodes/errorcode-wifi.md new file mode 100644 index 0000000000000000000000000000000000000000..1d7443e49c03cc29f89c5b5d426eda752e7c36a7 --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-wifi.md @@ -0,0 +1,124 @@ +# 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. diff --git a/en/application-dev/reference/native-apis/Readme-EN.md b/en/application-dev/reference/native-apis/Readme-EN.md index 1101b441d4dc99531bf9373ebda56f7ef750d49a..723a05c95404a4090c3e1e8b06ce23500e8e29c5 100644 --- a/en/application-dev/reference/native-apis/Readme-EN.md +++ b/en/application-dev/reference/native-apis/Readme-EN.md @@ -4,7 +4,10 @@ - [Native XComponent](_o_h___native_x_component.md) - [HiLog](_hi_log.md) - [NativeWindow](_native_window.md) + - [OH_NativeBuffer](_o_h___native_buffer.md) - [Drawing](_drawing.md) + - [OH_NativeImage](_o_h___native_image.md) + - [NativeVsync](_native_vsync.md) - [Image](image.md) - [Rawfile](rawfile.md) - [MindSpore](_mind_spore.md) @@ -32,7 +35,10 @@ - [external_window.h](external__window_8h.md) - [image_pixel_map_napi.h](image__pixel__map__napi_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_vsync.h](native__vsync_8h.md) - [raw_dir.h](raw__dir_8h.md) - [raw_file_manager.h](raw__file__manager_8h.md) - [raw_file.h](raw__file_8h.md) @@ -58,6 +64,7 @@ - [native_huks_type.h](native__huks__type_8h.md) - Structs - [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_MouseEvent](_o_h___native_x_component___mouse_event.md) - [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) @@ -65,7 +72,6 @@ - [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) - [OHExtDataHandle](_o_h_ext_data_handle.md) - [OHHDRMetaData](_o_h_h_d_r_meta_data.md) - - [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) - [OhosPixelMapInfo](_ohos_pixel_map_info.md) - [RawFileDescriptor](_raw_file_descriptor.md) - [Region](_region.md) diff --git a/en/application-dev/reference/native-apis/_native_vsync.md b/en/application-dev/reference/native-apis/_native_vsync.md new file mode 100644 index 0000000000000000000000000000000000000000..531ef2634efe8b4e4f734532cc12599e54c750a8 --- /dev/null +++ b/en/application-dev/reference/native-apis/_native_vsync.md @@ -0,0 +1,149 @@ +# 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.
File to include: <native_vsync/native_vsync.h>| + + +### 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. diff --git a/en/application-dev/reference/native-apis/_o_h___native_buffer.md b/en/application-dev/reference/native-apis/_o_h___native_buffer.md new file mode 100644 index 0000000000000000000000000000000000000000..3bd77436cbcad66ad168a6b158cd7de75bc20903 --- /dev/null +++ b/en/application-dev/reference/native-apis/_o_h___native_buffer.md @@ -0,0 +1,233 @@ +# 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**.
File to include: <native_buffer/native_buffer.h> | + + +### 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. diff --git a/en/application-dev/reference/native-apis/_o_h___native_buffer___config.md b/en/application-dev/reference/native-apis/_o_h___native_buffer___config.md new file mode 100644 index 0000000000000000000000000000000000000000..b08c50eaf3f57f0c15890695779b88273afa30f6 --- /dev/null +++ b/en/application-dev/reference/native-apis/_o_h___native_buffer___config.md @@ -0,0 +1,29 @@ +# 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.| diff --git a/en/application-dev/reference/native-apis/_o_h___native_image.md b/en/application-dev/reference/native-apis/_o_h___native_image.md new file mode 100644 index 0000000000000000000000000000000000000000..f9968d4343c39b51e7c16b57bf966f88a70f80c8 --- /dev/null +++ b/en/application-dev/reference/native-apis/_o_h___native_image.md @@ -0,0 +1,267 @@ +# 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**.
File to include: <native_image/native_image.h> | + + +### 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.
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. diff --git a/en/application-dev/reference/native-apis/_ohos_pixel_map_create_ops.md b/en/application-dev/reference/native-apis/_ohos_pixel_map_create_ops.md deleted file mode 100644 index 330a50ddd7bbe1b790834ce2ce62ef94e0ab8b08..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/native-apis/_ohos_pixel_map_create_ops.md +++ /dev/null @@ -1,91 +0,0 @@ -# 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**
-Alpha type of the image. - - -### editable - - -``` -uint32_t OhosPixelMapCreateOps::editable -``` -**Description**
-Editing type of the image. - - -### height - - -``` -uint32_t OhosPixelMapCreateOps::height -``` -**Description**
-Image height, in pixels. - - -### pixelFormat - - -``` -int32_t OhosPixelMapCreateOps::pixelFormat -``` -**Description**
-Image format. - - -### scaleMode - - -``` -uint32_t OhosPixelMapCreateOps::scaleMode -``` -**Description**
-Scale mode of the image. - - -### width - - -``` -uint32_t OhosPixelMapCreateOps::width -``` -**Description**
-Image width, in pixels. diff --git a/en/application-dev/reference/native-apis/image.md b/en/application-dev/reference/native-apis/image.md index 365d04c8dca0a1b718593337237a8e5fb4f0bcb9..f485c2db67340066f459425044d1102f72bae073 100644 --- a/en/application-dev/reference/native-apis/image.md +++ b/en/application-dev/reference/native-apis/image.md @@ -9,6 +9,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. **Since** + 8 @@ -19,7 +20,7 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. | 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.
File to include:: | +| [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | Declares the APIs that can lock, access, and unlock a pixel map.
File to include: | ### Structs @@ -27,25 +28,14 @@ To use the APIs in this file, **libpixelmap_ndk.z.so** is required. | Name| Description| | -------- | -------- | | [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](#nativepixelmap) | Defines the data type name of the native pixel map.| - - -### Enums - | Name| Description| | -------- | -------- | | { 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_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 @@ -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_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_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 -### NativePixelMap - - -``` -typedef struct NativePixelMap -``` -**Description** - -Defines the data type name of the native pixel map. - -**Since** - -9 - - -## Enum Description - - ### anonymous enum @@ -132,68 +89,7 @@ Enumerates the pixel formats. 8 -### 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 +## anonymous enum ### OH_AccessPixels() @@ -258,467 +154,6 @@ Returns **0** if the information is obtained and stored successfully; returns an 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() @@ -746,4 +181,5 @@ AccessPixels **Since** -8 \ No newline at end of file +8 + diff --git a/en/application-dev/reference/native-apis/image__pixel__map__napi_8h.md b/en/application-dev/reference/native-apis/image__pixel__map__napi_8h.md index aea56bd66bd0cd29f3200787c73264acb07c6bad..3612f6b706a42deaddbe809a84914dae3171435d 100644 --- a/en/application-dev/reference/native-apis/image__pixel__map__napi_8h.md +++ b/en/application-dev/reference/native-apis/image__pixel__map__napi_8h.md @@ -21,13 +21,7 @@ Declares the APIs that can lock, access, and unlock pixel map data. | Name | Description | | -------- | -------- | | [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 @@ -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_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 @@ -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_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. diff --git a/en/application-dev/reference/native-apis/native__buffer_8h.md b/en/application-dev/reference/native-apis/native__buffer_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..8c07b912816135a48d6a912846bfb12c67f69c50 --- /dev/null +++ b/en/application-dev/reference/native-apis/native__buffer_8h.md @@ -0,0 +1,44 @@ +# 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.| diff --git a/en/application-dev/reference/native-apis/native__image_8h.md b/en/application-dev/reference/native-apis/native__image_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..ba0f3a6d844697f09327898fadb8ff27d8e67628 --- /dev/null +++ b/en/application-dev/reference/native-apis/native__image_8h.md @@ -0,0 +1,39 @@ +# 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.
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**. | diff --git a/en/application-dev/reference/native-apis/native__vsync_8h.md b/en/application-dev/reference/native-apis/native__vsync_8h.md new file mode 100644 index 0000000000000000000000000000000000000000..867760ea09fdd2e9c6233b68e0341ad1e97c5392 --- /dev/null +++ b/en/application-dev/reference/native-apis/native__vsync_8h.md @@ -0,0 +1,34 @@ +# 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.| diff --git a/en/application-dev/security/accesstoken-guidelines.md b/en/application-dev/security/accesstoken-guidelines.md index 93e6b808074f476ab103ee1b43db856d7ab472d6..59f4ab042f13956740232fe4e7a3c2fbfe4d7bc2 100644 --- a/en/application-dev/security/accesstoken-guidelines.md +++ b/en/application-dev/security/accesstoken-guidelines.md @@ -125,7 +125,7 @@ User authorization is required when an application needs to access user privacy > **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 diff --git a/en/application-dev/security/accesstoken-overview.md b/en/application-dev/security/accesstoken-overview.md index b6eb50c0d37613e8bd7ee1ca98e1f86b9002ceea..a6bad0e40cc705ba4b0d66b2ab179ff874fc9286 100644 --- a/en/application-dev/security/accesstoken-overview.md +++ b/en/application-dev/security/accesstoken-overview.md @@ -39,10 +39,14 @@ The figure below illustrates the process. ![](figures/permission-workflow.png) +**NOTE** + 1. Refer to the figure below to determine whether an application can apply for a permission. ![](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. 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. ![](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. 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. diff --git a/en/application-dev/website.md b/en/application-dev/website.md index c6274ffeb0a2f423c5dee149ef1fbe27750c2888..ba50a5692c68b22b0e54a4d68bc70d3c5f8a84c4 100644 --- a/en/application-dev/website.md +++ b/en/application-dev/website.md @@ -36,30 +36,30 @@ - Application Configuration Files in FA Model - [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 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) - - [Resource Categories and Access](quick-start/resource-categories-and-access.md) - - Learning ArkTS - - [Getting Started with ArkTS](quick-start/arkts-get-started.md) + - [Resource Categories and Access](quick-start/resource-categories-and-access.md) + - Learning ArkTS + - [Getting Started with ArkTS](quick-start/arkts-get-started.md) - Basic Syntax - [Basic Syntax Overview](quick-start/arkts-basic-syntax-overview.md) - [Declarative UI Description](quick-start/arkts-declarative-ui-description.md) - Custom Component - [Creating a Custom Component](quick-start/arkts-create-custom-components.md) - [Page and Custom Component Lifecycle](quick-start/arkts-page-custom-components-lifecycle.md) - - [\@Builder: Custom Builder Function](quick-start/arkts-builder.md) - - [\@BuilderParam: @Builder Function Reference](quick-start/arkts-builderparam.md) - - [\@Styles: Definition of Resusable Styles](quick-start/arkts-style.md) - - [\@Extend: Extension of Built-in Components](quick-start/arkts-extend.md) + - [\@Builder Decorator: Custom Builder Function](quick-start/arkts-builder.md) + - [\@BuilderParam Decorator: \@Builder Function Reference](quick-start/arkts-builderparam.md) + - [\@Styles Decorator: Definition of Resusable Styles](quick-start/arkts-style.md) + - [\@Extend Decorator: Extension of Built-in Components](quick-start/arkts-extend.md) - [stateStyles: Polymorphic Style](quick-start/arkts-statestyles.md) - State Management - [State Management Overview](quick-start/arkts-state-management-overview.md) - Component State Management - - [\@State: State Owned by Component](quick-start/arkts-state.md) - - [\@Prop: 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) - - [\@Provide and \@Consume: 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) + - [\@State Decorator: State Owned by Component](quick-start/arkts-state.md) + - [\@Prop Decorator: One-Way Synchronization from Parent to Child Components](quick-start/arkts-prop.md) + - [\@Link Decorator: Two-Way Synchronization Between Parent and Child Components](quick-start/arkts-link.md) + - [\@Provide and \@Consume Decorators: Two-Way Synchronization with Descendant Components](quick-start/arkts-provide-and-consume.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 Overview](quick-start/arkts-application-state-management-overview.md) - [LocalStorage: UI State Storage](quick-start/arkts-localstorage.md) @@ -68,10 +68,10 @@ - [Environment: Device Environment Query](quick-start/arkts-environment.md) - Other State Management Features - [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) - 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) - [ForEach: Rendering of Repeated Content](quick-start/arkts-rendering-control-foreach.md) - [LazyForEach: Lazy Data Loading](quick-start/arkts-rendering-control-lazyforeach.md) @@ -82,7 +82,7 @@ - [Interpretation of the Application Model](application-models/application-model-description.md) - Stage Model Development - [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) - UIAbility Component - [UIAbility Component Overview](application-models/uiability-overview.md) @@ -159,7 +159,7 @@ - [Page Stack and MissionList](application-models/page-mission-stack.md) - FA Model Development - [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) - PageAbility Component Development - [PageAbility Component Overview](application-models/pageability-overview.md) @@ -241,39 +241,39 @@ - Layout Development - [Layout Overview](ui/arkts-layout-development-overview.md) - Building a Layout - - [Linear Layout](ui/arkts-layout-development-linear.md) - - [Stack Layout](ui/arkts-layout-development-stack-layout.md) - - [Flex Layout](ui/arkts-layout-development-flex-layout.md) - - [Relative Layout](ui/arkts-layout-development-relative-layout.md) - - [Responsive Grid Layout](ui/arkts-layout-development-grid-layout.md) - - [Media Query](ui/arkts-layout-development-media-query.md) - - [Creating a List](ui/arkts-layout-development-create-list.md) - - [Creating a Grid](ui/arkts-layout-development-create-grid.md) - - [Creating a Swiper](ui/arkts-layout-development-create-looping.md) + - [Linear Layout (Row/Column)](ui/arkts-layout-development-linear.md) + - [Stack Layout (Stack)](ui/arkts-layout-development-stack-layout.md) + - [Flex Layout (Flex)](ui/arkts-layout-development-flex-layout.md) + - [Relative Layout (RelativeContainer)](ui/arkts-layout-development-relative-layout.md) + - [Responsive Grid Layout (GridRow/GridCol)](ui/arkts-layout-development-grid-layout.md) + - [Media Query (mediaquery)](ui/arkts-layout-development-media-query.md) + - [Creating a List (List)](ui/arkts-layout-development-create-list.md) + - [Creating a Grid (Grid/GridItem)](ui/arkts-layout-development-create-grid.md) + - [Creating a Swiper (Swiper)](ui/arkts-layout-development-create-looping.md) - [Improving Layout Performance](ui/arkts-layout-development-performance-boost.md) - Adding a Component - Adding a Common Component - [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) - - [Progress Indicator](ui/arkts-common-components-progress-indicator.md) - - [Text Display](ui/arkts-common-components-text-display.md) - - [Text Input](ui/arkts-common-components-text-input.md) - - [Custom Dialog Box](ui/arkts-common-components-custom-dialog.md) - - [Video Playback](ui/arkts-common-components-video-player.md) + - [Progress Indicator (Progress)](ui/arkts-common-components-progress-indicator.md) + - [Text Display (Text/Span)](ui/arkts-common-components-text-display.md) + - [Text Input (TextInput/TextArea)](ui/arkts-common-components-text-input.md) + - [Custom Dialog Box (CustomDialog)](ui/arkts-common-components-custom-dialog.md) + - [Video Playback (Video)](ui/arkts-common-components-video-player.md) - [XComponent](ui/arkts-common-components-xcomponent.md) - 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) - Setting Page Routing and Component Navigation - - [Page Routing](ui/arkts-routing.md) + - [Page Routing (router)](ui/arkts-routing.md) - Component Navigation - [Navigation](ui/arkts-navigation-navigation.md) - [Tabs](ui/arkts-navigation-tabs.md) - Using Graphics - - [Displaying Images](ui/arkts-graphics-display.md) - - [Drawing Geometric Shapes](ui/arkts-geometric-shape-drawing.md) - - [Drawing Custom Graphics on the Canvas](ui/arkts-drawing-customization-on-canvas.md) + - [Displaying Images (Image)](ui/arkts-graphics-display.md) + - [Drawing Geometric Shapes (Shape)](ui/arkts-geometric-shape-drawing.md) + - [Drawing Custom Graphics on the Canvas (Canvas)](ui/arkts-drawing-customization-on-canvas.md) - Using Animation - [Animation Overview](ui/arkts-animation-overview.md) - Animation Within a Page @@ -294,9 +294,9 @@ - [Single Gesture](ui/arkts-gesture-events-single-gesture.md) - [Combined Gestures](ui/arkts-gesture-events-combined-gestures.md) - [Recommendations for Improving Performance](ui/arkts-performance-improvement-recommendation.md) - - UI Development (JavaScript-compatible Web-like Development Paradigm) - - [UI Development (JavaScript-compatible Web-like Development Paradigm) Overview](ui/ui-js-overview.md) - - Framework Overview + - UI Development with JavaScript-compatible Web-like Development Paradigm + - [UI Development with JavaScript-compatible Web-like Development Paradigm Overview](ui/ui-js-overview.md) + - Framework - [File Organization](ui/js-framework-file.md) - ["js" Tag](ui/js-framework-js-tag.md) - [app.js](ui/js-framework-js-file.md) @@ -347,7 +347,7 @@ - [Canvas](ui/ui-js-components-canvas.md) - [CanvasRenderingContext2D](ui/ui-js-components-canvasrenderingcontext2d.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) - Svg - [Basics](ui/ui-js-components-svg-overview.md) @@ -514,7 +514,7 @@ - Cross-Application Data Sharing (for System Applications Only) - [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 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 Overview](file-management/file-management-overview.md) - Application File @@ -522,7 +522,7 @@ - [Application Sandbox Directory](file-management/app-sandbox-directory.md) - Application File Access and Management - [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) - [Sending Files to an Application Sandbox](file-management/send-file-to-app-sandbox.md) - [Sharing an Application File](file-management/share-app-file.md) @@ -531,8 +531,8 @@ - Selecting and Saving User Files (FilePicker) - [Selecting User Files](file-management/select-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) - - [Managing External Storage Devices (Available Only for System Applications)](file-management/manage-external-storage.md) + - [Developing a FileManager Application (for System Applications Only)](file-management/dev-user-file-manager.md) + - [Managing External Storage Devices (for System Applications Only)](file-management/manage-external-storage.md) - Distributed File System - [Distributed File System Overview](file-management/distributed-fs-overview.md) - [Setting the Security Level of a Distributed File](file-management/set-security-label.md) @@ -606,325 +606,15 @@ - Packing and Unpacking Tools - [Packing Tools](tools/packing-tool.md) - [Unpacking Tools](tools/unpacking-tool.md) - - [Advanced Notification Manager](tools/cem-tool.md) - - [Common Event Manager](tools/anm-tool.md) + - [Common Event Manager](tools/cem-tool.md) + - [Advanced Notification Manager](tools/anm-tool.md) - Hands-On Tutorials - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/OpenHarmony-3.2-Release/README.md) - [Codelabs](https://gitee.com/openharmony/codelabs) - API References - [SystemCapability](reference/syscap.md) - [SystemCapability List](reference/syscap-list.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 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 + - ArkTS API Reference - [API Reference Document Description](reference/apis/development-intro.md) - Ability Framework - Stage Model (Recommended) @@ -1087,6 +777,7 @@ - UI Page - [@ohos.animator (Animator)](reference/apis/js-apis-animator.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.mediaquery (Media Query)](reference/apis/js-apis-mediaquery.md) - [@ohos.pluginComponent (PluginComponentManager)](reference/apis/js-apis-plugincomponent.md) @@ -1111,7 +802,7 @@ - [@ohos.multimedia.camera (Camera Management)](reference/apis/js-apis-camera.md) - [@ohos.multimedia.image (Image Processing)](reference/apis/js-apis-image.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.intl (Internationalization)](reference/apis/js-apis-intl.md) - [@ohos.resourceManager (Resource Manager)](reference/apis/js-apis-resource-manager.md) @@ -1253,7 +944,7 @@ - [@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.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.convertxml (XML-to-JavaScript Conversion)](reference/apis/js-apis-convertxml.md) - [@ohos.process (Obtaining Process Information)](reference/apis/js-apis-process.md) @@ -1279,7 +970,7 @@ - [@ohos.xml (XML Parsing and Generation)](reference/apis/js-apis-xml.md) - Test - [@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 - [@ohos.backgroundTaskManager (Background Task Management)](reference/apis/js-apis-backgroundTaskManager.md) - [@ohos.bluetooth (Bluetooth)](reference/apis/js-apis-bluetooth.md) @@ -1311,7 +1002,7 @@ - [@system.device (Device Information)](reference/apis/js-apis-system-device.md) - [@system.fetch (Data Request)](reference/apis/js-apis-system-fetch.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.network (Network State)](reference/apis/js-apis-system-network.md) - [@system.notification (Notification)](reference/apis/js-apis-system-notification.md) @@ -1338,6 +1029,349 @@ - [shortcutInfo](reference/apis/js-apis-bundle-ShortcutInfo.md) - data/rdb - [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 - [Universal Error Codes](reference/errorcodes/errorcode-universal.md) - Ability Framework @@ -1347,7 +1381,7 @@ - Bundle Management - [Bundle Error Codes](reference/errorcodes/errorcode-bundle.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) - [Notification Error Codes](reference/errorcodes/errorcode-notification.md) - [DistributedNotificationService Error Codes](reference/errorcodes/errorcode-DistributedNotificationService.md) @@ -1363,7 +1397,7 @@ - [Audio Error Codes](reference/errorcodes/errorcode-audio.md) - [Media Error Codes](reference/errorcodes/errorcode-media.md) - [AVSession Management Error Codes](reference/errorcodes/errorcode-avsession.md) - - Resource Manager + - Resource Management - [I18N Error Codes](reference/errorcodes/errorcode-i18n.md) - [Resource Manager Error Codes](reference/errorcodes/errorcode-resource-manager.md) - Background Task @@ -1426,8 +1460,8 @@ - [Update Error Codes](reference/errorcodes/errorcode-update.md) - Customization - [Enterprise Device Management Error Codes](reference/errorcodes/errorcode-enterpriseDeviceManager.md) - - Language Base Class Library - - [Utils Error Codes](reference/errorcodes/errorcode-utils.md) + - Common Library + - [Common Library Error Codes](reference/errorcodes/errorcode-utils.md) - Test - [UiTest Error Codes](reference/errorcodes/errorcode-uitest.md) - Native APIs @@ -1435,7 +1469,10 @@ - [Native XComponent](reference/native-apis/_o_h___native_x_component.md) - [HiLog](reference/native-apis/_hi_log.md) - [NativeWindow](reference/native-apis/_native_window.md) + - [OH_NativeBuffer](reference/native-apis/_o_h___native_buffer.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) - [Rawfile](reference/native-apis/rawfile.md) - [MindSpore](reference/native-apis/_mind_spore.md) @@ -1463,7 +1500,10 @@ - [external_window.h](reference/native-apis/external__window_8h.md) - [image_pixel_map_napi.h](reference/native-apis/image__pixel__map__napi_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_vsync.h](reference/native-apis/native__vsync_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.h](reference/native-apis/raw__file_8h.md) @@ -1489,6 +1529,7 @@ - [native_huks_type.h](reference/native-apis/native__huks__type_8h.md) - Structs - [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_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) @@ -1496,7 +1537,6 @@ - [OH_NativeXComponent_TouchPoint](reference/native-apis/_o_h___native_x_component___touch_point.md) - [OHExtDataHandle](reference/native-apis/_o_h_ext_data_handle.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) - [RawFileDescriptor](reference/native-apis/_raw_file_descriptor.md) - [Region](reference/native-apis/_region.md) @@ -1522,7 +1562,7 @@ - [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_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) - [libuv](reference/native-lib/third_party_libuv/libuv.md) - [Native Standard Libraries Supported by Openharmony](reference/native-lib/third_party_libc/musl.md) diff --git a/en/device-dev/device-test/figures/smartperf_frame.png b/en/device-dev/device-test/figures/smartperf_frame.png new file mode 100644 index 0000000000000000000000000000000000000000..4cd602ed03837c570efee4dc3887272414b391e5 Binary files /dev/null and b/en/device-dev/device-test/figures/smartperf_frame.png differ diff --git a/en/device-dev/device-test/smartperf-host.md b/en/device-dev/device-test/smartperf-host.md new file mode 100644 index 0000000000000000000000000000000000000000..ec92a1ba4c2c5ca57957702de1e9fe9c8cb54c9c --- /dev/null +++ b/en/device-dev/device-test/smartperf-host.md @@ -0,0 +1,83 @@ +# 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/**. diff --git a/en/device-dev/subsystems/figures/build_process.png b/en/device-dev/subsystems/figures/build_process.png index 746ba24a707b37b7b955c4e1d9ae78fb0c3ca636..e1f83acf3bba84ecd42d5a4db59f9d03bfd2527a 100644 Binary files a/en/device-dev/subsystems/figures/build_process.png and b/en/device-dev/subsystems/figures/build_process.png differ diff --git a/zh-cn/application-dev/application-models/uiability-data-sync-with-ui.md b/zh-cn/application-dev/application-models/uiability-data-sync-with-ui.md index 84ff19a40bedbb0729542c5ca911d19a850a0d6e..be3730e0887155fc318e322d337eb707b8839835 100644 --- a/zh-cn/application-dev/application-models/uiability-data-sync-with-ui.md +++ b/zh-cn/application-dev/application-models/uiability-data-sync-with-ui.md @@ -4,15 +4,15 @@ 基于OpenHarmony的应用模型,可以通过以下几种方式来实现UIAbility组件与UI之间的数据同步。 - [使用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级别的数据同步。 ## 使用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)有如下两种调用方式,使用其中一种即可。 @@ -89,7 +89,7 @@ globalThis是[ArkTS引擎实例](thread-model-stage.md)内部的一个全局对象,引擎内部的UIAbility/ExtensionAbility/Page都可以使用,因此可以使用globalThis对象进行数据同步。 -**图1** 使用globalThis进行数据同步 +**图1** 使用globalThis进行数据同步 ![globalThis1](figures/globalThis1.png) @@ -123,14 +123,14 @@ globalThis是[ArkTS引擎实例](thread-model-stage.md)内部的一个全局对 ```ts let entryAbilityWant; - + @Entry @Component struct Index { aboutToAppear() { entryAbilityWant = globalThis.entryAbilityWant; } - + // 页面展示 build() { ... @@ -160,7 +160,7 @@ globalThis是[ArkTS引擎实例](thread-model-stage.md)内部的一个全局对 ```ts import UIAbility from '@ohos.app.ability.UIAbility' - + export default class UIAbilityB extends UIAbility { onCreate(want, launch) { // UIAbilityB从globalThis读取name并输出 @@ -193,7 +193,7 @@ globalThis是[ArkTS引擎实例](thread-model-stage.md)内部的一个全局对 ```ts import Extension from '@ohos.app.ability.ServiceExtensionAbility' - + export default class ServiceExtAbility extends Extension { onCreate(want) { // ServiceExtAbility从globalThis读取name并输出 @@ -206,11 +206,13 @@ globalThis是[ArkTS引擎实例](thread-model-stage.md)内部的一个全局对 ### globalThis使用的注意事项 -**图2** globalThis注意事项 +**图2** globalThis注意事项 ![globalThis2](figures/globalThis2.png) - Stage模型下进程内的UIAbility组件共享ArkTS引擎实例,使用globalThis时需要避免存放相同名称的对象。例如UIAbilityA和UIAbilityB可以使用globalThis共享数据,在存放相同名称的对象时,先存放的对象会被后存放的对象覆盖。 +- globalThis不支持跨进程使用,不同进程的UIAbility组件和ExtensionAbility组件无法使用globalThis共享数据,进程模型及进程间通信机制见[进程模型概述](./process-model-stage.md#进程模型概述)。 + - FA模型因为每个UIAbility组件之间引擎隔离,不会存在该问题。 - 对于绑定在globalThis上的对象,其生命周期与ArkTS虚拟机实例相同,建议在使用完成之后将其赋值为null,以减少对应用内存的占用。 diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/visual-basics.md b/zh-cn/application-dev/key-features/multi-device-app-dev/visual-basics.md index 3a6d725e5432a2520631189b190a8f567a9c86f0..785cac2775829c082f77a7d9e6c3b1995fec6dca 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/visual-basics.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/visual-basics.md @@ -31,8 +31,7 @@ **字体像素单位:fp** -字体像素(font pixel) 大小默认情况下与 vp 相同,即默认情况下 1 fp = 1vp。如果用户在设置中选择了更大的字体,字体的实际显示大小就会在 vp 的基础上乘以 scale 系数,即 1 fp = 1 vp \* scale。 - +字体像素(font pixel) 大小默认情况下与 vp 相同,即默认情况下 1 fp = 1vp。 **视觉属性:分层参数** diff --git a/zh-cn/application-dev/napi/drawing-guidelines.md b/zh-cn/application-dev/napi/drawing-guidelines.md index 76b2d84b93a5ab76ed0d390f7517fcd9862bc01b..82ce746e884ce12a6bab46d7e871f1b4bcf9eca2 100644 --- a/zh-cn/application-dev/napi/drawing-guidelines.md +++ b/zh-cn/application-dev/napi/drawing-guidelines.md @@ -198,9 +198,3 @@ Native Drawing模块提供了一系列的接口用于基本图形和字体的绘 // 将文本绘制到画布上 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)。 diff --git a/zh-cn/application-dev/napi/native-window-guidelines.md b/zh-cn/application-dev/napi/native-window-guidelines.md index 0bc953f8d2fb3bdd548feb1d7a5f186afb179e6d..022fb52d81147c1289ebcc4faea04d3b506213a7 100644 --- a/zh-cn/application-dev/napi/native-window-guidelines.md +++ b/zh-cn/application-dev/napi/native-window-guidelines.md @@ -150,9 +150,3 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生 // 通过OH_NativeWindow_NativeWindowFlushBuffer 提交给消费者使用,例如:显示在屏幕上。 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) diff --git a/zh-cn/application-dev/quick-start/app-configuration-file.md b/zh-cn/application-dev/quick-start/app-configuration-file.md index 2ed9c0766da654a416a5f4d137467b7f8201e200..e086662aef3989e6aff03189d78d16a3d46ab8c1 100644 --- a/zh-cn/application-dev/quick-start/app-configuration-file.md +++ b/zh-cn/application-dev/quick-start/app-configuration-file.md @@ -45,7 +45,7 @@ app.json5配置文件包含以下标签。 | minAPIVersion | 标识应用运行需要的SDK的API最小版本。 | 数值 | 由build-profile.json5中的compatibleSdkVersion生成。 | | targetAPIVersion | 标识应用运行需要的API目标版本。 | 数值 | 由build-profile.json5中的compileSdkVersion生成。 | | apiReleaseType | 标识应用运行需要的API目标版本的类型,采用字符串类型表示。取值为“CanaryN”、“BetaN”或者“Release”,其中,N代表大于零的整数。
- Canary:受限发布的版本。
- Beta:公开发布的Beta版本。
- Release:公开发布的正式版本。
该字段由DevEco Studio读取当前使用的SDK的Stage来生成。 | 字符串 | 该标签可缺省,由IDE生成并覆盖。 | -| multiProjects | 标识当前工程是否支持多个工程的联合开发。
- true:当前工程支持多个工程的联合开发。
- false:当前工程不支持多个工程的联合开发。多工程开发可以参考文档:[多工程构建](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-building-overview-0000001263360495-V3#section71471033104216) | 布尔值 | 可缺省,缺省值为false。 | +| multiProjects | 标识当前工程是否支持多个工程的联合开发。
- true:当前工程支持多个工程的联合开发。
- false:当前工程不支持多个工程的联合开发。多工程开发可以参考文档:[多工程构建](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/build_overview-0000001055075201-V3#section73401914284)。 | 布尔值 | 可缺省,缺省值为false。 | | tablet | 标识对tablet设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。
如果使用该属性对tablet设备做了特殊配置,则应用在tablet设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tablet设备使用app.json5公共区域配置的属性值。 | | tv | 标识对tv设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。
如果使用该属性对tv设备做了特殊配置,则应用在tv设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tv设备使用app.json5公共区域配置的属性值。 | | wearable | 标识对wearable设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。
如果使用该属性对wearable设备做了特殊配置,则应用在wearable设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时wearable设备使用app.json5公共区域配置的属性值。 | diff --git a/zh-cn/application-dev/quick-start/arkts-localstorage.md b/zh-cn/application-dev/quick-start/arkts-localstorage.md index 9b5ff96f2dc9cb132239090222c9342fe4697212..c05a4b844751dcb76be12414e8d700f9eac21393 100644 --- a/zh-cn/application-dev/quick-start/arkts-localstorage.md +++ b/zh-cn/application-dev/quick-start/arkts-localstorage.md @@ -26,7 +26,7 @@ LocalStorage是ArkTS为构建页面级别状态变量提供存储的内存内“ 应用程序决定LocalStorage对象的生命周期。当应用释放最后一个指向LocalStorage的引用时,比如销毁最后一个自定义组件,LocalStorage将被JS Engine垃圾回收。 -LocalStorage根据与\@Component装饰的组件的的同步类型不同,提供了两个装饰器: +LocalStorage根据与\@Component装饰的组件的同步类型不同,提供了两个装饰器: - [@LocalStorageProp](#localstorageprop):\@LocalStorageProp装饰的变量和与LocalStorage中给定属性建立单行同步关系。 @@ -306,7 +306,7 @@ struct CompA { 先看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绑定的组件会同步刷新; diff --git a/zh-cn/application-dev/quick-start/arkts-watch.md b/zh-cn/application-dev/quick-start/arkts-watch.md index f23723177de596166dbe9c836fdc1e4e3e5129b5..8cee38d2db9465ada640675f0585e896dbb1abfb 100644 --- a/zh-cn/application-dev/quick-start/arkts-watch.md +++ b/zh-cn/application-dev/quick-start/arkts-watch.md @@ -131,7 +131,7 @@ struct BasketModifier { ### \@Watch和自定义组件更新 -以下示例展示组件更新和\@Watch的处理步骤。count在两个组件中均由\@State装饰。 +以下示例展示组件更新和\@Watch的处理步骤。count在CountModifier中由\@State装饰,在TotalView中由\@Prop装饰。 ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md index 1f281d4a6dccd6212acb48871d98e5467077f5f8..128e095e0070d0c7eecbab2e284bff338d76d797 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -645,7 +645,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleName = "com.example.myapplication"; -bundleManager.setApplicationEnabled(bundleName, false).then(()=> { +bundle.setApplicationEnabled(bundleName, false).then(()=> { console.info('setApplicationEnabled successfully.'); }).catch(err=> { console.error('setApplicationEnabled failed.'); @@ -766,7 +766,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let permission = "ohos.permission.GET_BUNDLE_INFO"; -bundleManager.getPermissionDef(permission, (err, data) => { +bundle.getPermissionDef(permission, (err, data) => { if (err) { console.error('getPermissionDef failed:' + err.message); } else { diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md index 6416a97a1b4ffaf0117c32d95d38ed4b70dbf710..229958598d2b11e7fa2b43df6d9b44dbfcfad05f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -4525,10 +4525,10 @@ async function getCacheDir(){ } let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); -let currStat = await fs.stat(path); -let buf = new ArrayBuffer(bufferSize); -let len = currStat.size % bufferSize == 0 ? Math.floor(currStat.size / bufferSize) : Math.floor(currStat.size / bufferSize + 1); -for (let i = 0;i < len; i++) { +fs.stat(path).then((stat) => { + let buf = new ArrayBuffer(bufferSize); + let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); + for (let i = 0;i < len; i++) { let options = { offset: i * bufferSize, length: bufferSize @@ -4543,7 +4543,8 @@ for (let i = 0;i < len; i++) { } }) }) -} + } +}); ``` ### write8+ @@ -4578,21 +4579,22 @@ async function getCacheDir(){ } let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); -let currStat = await fs.stat(path); -let buf = new ArrayBuffer(bufferSize); -let len = currStat.size % bufferSize == 0 ? Math.floor(currStat.size / bufferSize) : Math.floor(currStat.size / bufferSize + 1); -for (let i = 0;i < len; i++) { - let options = { - offset: i * bufferSize, - length: bufferSize - } - let readsize = await fs.read(file.fd, buf, options) - try{ - let writeSize = await audioRenderer.write(buf); - } catch(err) { - console.error(`audioRenderer.write err: ${err}`); - } -} +fs.stat(path).then((stat) => { + let buf = new ArrayBuffer(bufferSize); + let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); + for (let i = 0;i < len; i++) { + let options = { + offset: i * bufferSize, + length: bufferSize + } + let readsize = await fs.read(file.fd, buf, options) + try{ + let writeSize = await audioRenderer.write(buf); + } catch(err) { + console.error(`audioRenderer.write err: ${err}`); + } + } +}); ``` ### getAudioTime8+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md index b18850c6afa60d3ae9f4f088c48102ddcf595d74..624ccf818130f9e36753387711aa55f053f45c24 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md @@ -41,7 +41,7 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor'; | 名称 | 说明 | | ---------- | --------------- | -| app | 监听应用事件。 | +| add | 监听应用事件。 | | update | 监听更新事件。 | | remove | 监听删除事件。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md index 5dd6258ebf1bb81e50e9977816c33ffa4983ebf9..e18f3df6ed6ca0f84c03ca9115f414262590576c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md @@ -40,7 +40,7 @@ getPreferences(context: Context, name: string, callback: AsyncCallback<Prefer | -------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ | | context | Context | 是 | 应用上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | name | string | 是 | Preferences实例的名称。 | -| callback | AsyncCallback<[Preferences](#preferences)> | 是 | 回调函数。当获取Preferences实例成功,err为undefined,返回Preferences实例;否则err为错误码。 | +| callback | AsyncCallback<[Preferences](#preferences)> | 是 | 回调函数。当获取Preferences实例成功,err为undefined,返回Preferences实例;否则err为错误对象。 | **示例:** @@ -177,7 +177,7 @@ deletePreferences(context: Context, name: string, callback: AsyncCallback<voi | -------- | ------------------------------------- | ---- | ---------------------------------------------------- | | context | Context | 是 | 应用上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | name | string | 是 | Preferences实例的名称。 | -| callback | AsyncCallback<void> | 是 | 回调函数。当移除成功,err为undefined,否则为错误码。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当移除成功,err为undefined,否则为错误对象。 | **错误码:** @@ -320,7 +320,7 @@ removePreferencesFromCache(context: Context, name: string, callback: AsyncCallba | -------- | ------------------------------------- | ---- | ---------------------------------------------------- | | context | Context | 是 | 应用上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | name | string | 是 | Preferences实例的名称。 | -| callback | AsyncCallback<void> | 是 | 回调函数。当移除成功,err为undefined,否则为错误码。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当移除成功,err为undefined,否则为错误对象。 | **示例:** @@ -452,7 +452,7 @@ get(key: string, defValue: ValueType, callback: AsyncCallback<ValueType>): | -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | | key | string | 是 | 要获取的存储Key名称,不能为空。 | | defValue | [ValueType](#valuetype) | 是 | 默认返回值。支持number、string、boolean、Array\、Array\、Array\类型。 | -| callback | AsyncCallback<[ValueType](#valuetype)> | 是 | 回调函数。当获取成功时,err为undefined,data为键对应的值;否则err为错误码。 | +| callback | AsyncCallback<[ValueType](#valuetype)> | 是 | 回调函数。当获取成功时,err为undefined,data为键对应的值;否则err为错误对象。 | **示例:** @@ -519,7 +519,7 @@ getAll(callback: AsyncCallback<Object>): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback<Object> | 是 | 回调函数。当获取成功,err为undefined,value为含有所有键值的Object对象;否则err为错误码。 | +| callback | AsyncCallback<Object> | 是 | 回调函数。当获取成功,err为undefined,value为含有所有键值的Object对象;否则err为错误对象。 | **示例:** @@ -585,7 +585,7 @@ put(key: string, value: ValueType, callback: AsyncCallback<void>): void | -------- | ------------------------- | ---- | ------------------------------------------------------------ | | key | string | 是 | 要修改的存储的Key,不能为空。 | | value | [ValueType](#valuetype) | 是 | 存储的新值。支持number、string、boolean、Array\、Array\、Array\类型。 | -| callback | AsyncCallback<void> | 是 | 回调函数。当数据写入成功,err为undefined;否则为错误码。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当数据写入成功,err为undefined;否则为错误对象。 | **示例:** @@ -730,7 +730,7 @@ delete(key: string, callback: AsyncCallback<void>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------------------------------------------------- | | key | string | 是 | 要删除的存储Key名称,不能为空。 | -| callback | AsyncCallback<void> | 是 | 回调函数。当删除成功,err为undefined;否则为错误码。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当删除成功,err为undefined;否则为错误对象。 | **示例:** @@ -797,7 +797,7 @@ flush(callback: AsyncCallback<void>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------------------------------------------------- | -| callback | AsyncCallback<void> | 是 | 回调函数。当保存成功,err为undefined;否则为错误码。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当保存成功,err为undefined;否则为错误对象。 | **示例:** @@ -858,7 +858,7 @@ clear(callback: AsyncCallback<void>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------------------------------------------------- | -| callback | AsyncCallback<void> | 是 | 回调函数。当清除成功,err为undefined;否则为错误码。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当清除成功,err为undefined;否则为错误对象。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-subtype.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-subtype.md index ad0dcdade7eb8e05e066902451697ae36f538938..bdd00b42e5bf89834c83934c78eb83f9f429815b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-subtype.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-subtype.md @@ -18,14 +18,14 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype'; **系统能力:** SystemCapability.MiscServices.InputMethodFramework -| 名称 | 类型 | 可读 | 可写 | 必选 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -------- | -| label | string | 是 | 否 | 否 | 输入法子类型的标签。 | -| name | string | 是 | 否 | 是 | 输入法应用的包名。 | -| id | string | 是 | 否 | 是 | 输入法子类型的id。 | -| mode | string | 是 | 否 | 否 | 输入法子类型的模式,包括upper(大写)和lower(小写)。 | -| locale | string | 是 | 否 | 是 | 输入法子类型的方言版本。 | -| language | string | 是 | 否 | 是 | 输入法子类型的语言。 | -| icon | string | 是 | 否 | 否 | 输入法子类型的图标。 | -| iconId | number | 是 | 否 | 否 | 输入法子类型的图标id。 | -| extra | object | 是 | 是 | 是 | 输入法子类型的其他信息。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| label | string | 是 | 否 | 非必填。输入法子类型的标签。 | +| name | string | 是 | 否 | 必填。输入法应用的包名。 | +| id | string | 是 | 否 | 必填。输入法子类型的id。 | +| mode | string | 是 | 否 | 非必填。输入法子类型的模式,包括upper(大写)和lower(小写)。 | +| locale | string | 是 | 否 | 必填。输入法子类型的方言版本。 | +| language | string | 是 | 否 | 必填。 输入法子类型的语言。 | +| icon | string | 是 | 否 | 非必填。输入法子类型的图标。 | +| iconId | number | 是 | 否 | 非必填。输入法子类型的图标id。 | +| extra | object | 是 | 是 | 必填。输入法子类型的其他信息。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md index c9d05622207981548b15f36bfd3865576d306972..725e118f5c2baa4db6b482775ef592a518e5eb54 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md +++ b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @@ -1286,7 +1286,7 @@ setData(data: PasteData, callback: AsyncCallback<void>): void **示例:** ```js -let pasteData = pasteboard.createPlainTextData('content'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'content'); let systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(pasteData, (err, data) => { if (err) { @@ -1329,7 +1329,7 @@ setData(data: PasteData): Promise<void> **示例:** ```js -let pasteData = pasteboard.createPlainTextData('content'); +let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, 'content'); let systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(pasteData).then((data) => { console.info('Succeeded in setting PasteData.'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-rpc.md b/zh-cn/application-dev/reference/apis/js-apis-rpc.md index 5f9d08cfd7ba73b919ca412ab3fdca676ca69acf..9990b9011ce6870aa9f01fce385785f43c8c87cd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-rpc.md +++ b/zh-cn/application-dev/reference/apis/js-apis-rpc.md @@ -292,14 +292,6 @@ setSize(size: number): void | ------ | ------ | ---- | ------ | | size | number | 是 | MessageSequence实例的数据大小。以字节为单位。 | -**错误码:** - -以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) - - | 错误码ID | 错误信息 | - | -------- | -------- | - | 1900009 | write data to message sequence failed | - **示例:** ```ts @@ -333,7 +325,6 @@ setCapacity(size: number): void | 错误码ID | 错误信息 | | -------- | -------- | - | 1900009 | write data to message sequence failed | | 1900011 | parcel memory alloc failed | **示例:** @@ -460,12 +451,6 @@ rewindRead(pos: number): void | ------ | ------ | ---- | ------- | | pos | number | 是 | 开始读取数据的目标位置。 | -**错误码:** - - | 错误码ID | 错误信息 | - | -------- | -------- | - | 1900010 | read data from message sequence failed | - **示例:** ```ts @@ -498,12 +483,6 @@ rewindWrite(pos: number): void | ------ | ------ | ---- | ----- | | pos | number | 是 | 开始写入数据的目标位置。 | -**错误码:** - - | 错误码ID | 错误信息 | - | -------- | -------- | - | 1900009 | write data to message sequence failed | - **示例:** ```ts @@ -2944,8 +2923,8 @@ writeAshmem(ashmem: Ashmem): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | ------- | + | 1900003 | write to ashmem failed | **示例:** @@ -2986,7 +2965,7 @@ readAshmem(): Ashmem | 错误码ID | 错误信息 | | -------- | -------- | - | 1900010 | read data from message sequence failed | + | 1900004 | read from ashmem failed | **示例:** @@ -5958,7 +5937,7 @@ registerDeathRecipient(recipient: DeathRecipient, flags: number): void | 错误码ID | 错误信息 | | -------- | -------- | - | 1900005 | only proxy object permitted | + | 1900008 | proxy or remote object is invalid | ### addDeathrecipient(deprecated) @@ -6004,7 +5983,7 @@ unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void | 错误码ID | 错误信息 | | -------- | -------- | - | 1900005 | only proxy object permitted | + | 1900008 | proxy or remote object is invalid | ### removeDeathRecipient(deprecated) diff --git a/zh-cn/application-dev/reference/apis/js-apis-runninglock.md b/zh-cn/application-dev/reference/apis/js-apis-runninglock.md index ee5e434d5468d3c57a6234b60b4e8b5088ca1061..fec4ce2f1195ea9f89becf889a2323790bfbb14b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-runninglock.md +++ b/zh-cn/application-dev/reference/apis/js-apis-runninglock.md @@ -69,14 +69,6 @@ create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLo | type | [RunningLockType](#runninglocktype) | 是 | 要创建的锁的类型。 | | callback | AsyncCallback<[RunningLock](#runninglock)> | 是 | 回调函数。当创建锁成功,err为undefined,data为创建的RunningLock;否则为错误对象。 | -**错误码:** - -以下错误码的详细介绍请参见[RunningLock锁错误码](../errorcodes/errorcode-runninglock.md)。 - -| 错误码ID | 错误信息 | -|---------|----------| -| 4900101 | If connecting to the service failed. | - **示例:** ```js @@ -112,14 +104,6 @@ create(name: string, type: RunningLockType): Promise<RunningLock> | ------------------------------------------ | ------------------------------------ | | Promise<[RunningLock](#runninglock)> | Promise对象,返回RunningLock锁对象。 | -**错误码:** - -以下错误码的详细介绍请参见[RunningLock锁错误码](../errorcodes/errorcode-runninglock.md)。 - -| 错误码ID | 错误信息 | -|---------|----------| -| 4900101 | If connecting to the service failed. | - **示例:** ```js diff --git a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md index 50c56fb4b526a3ffdd70bdc9f20b8a431dd1810a..135127890f755216c91187f4e9c81d5e8e1f3c4e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @@ -9,7 +9,7 @@ ## 导入模块 ```js -import screenlock from '@ohos.screenLock'; +import screenLock from '@ohos.screenLock'; ``` ## EventType9+ @@ -50,7 +50,7 @@ import screenlock from '@ohos.screenLock'; | eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 | | params | string | 是 | 系统事件参数。 | -## screenlock.isLocked9+ +## screenLock.isLocked9+ isLocked(): boolean @@ -69,10 +69,10 @@ isLocked(): boolean **示例:** ```js -let isLocked = screenlock.isLocked(); +let isLocked = screenLock.isLocked(); ``` -## screenlock.unlock9+ +## screenLock.unlock9+ unlock(callback: AsyncCallback<boolean>): void @@ -98,17 +98,17 @@ unlock(callback: AsyncCallback<boolean>): void **示例:** -```js -screenlock.unlock((err, data) => { + ```js + screenLock.unlock((err, data) => { if (err) { - console.error(`Failed to unlock the screen, because: ${err.message}`); - return; + console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`); + return; } - console.info(`unlock the screen successfully. result: ${data}`); -}); -``` + console.info(`Succeeded in unlocking the screen. result: ${data}`); + }); + ``` -## screenlock.unlock9+ +## screenLock.unlock9+ unlock(): Promise<boolean> @@ -134,15 +134,15 @@ unlock(): Promise<boolean> **示例:** -```js -screenlock.unlock().then((data) => { - console.info(`unlock the screen successfully. result: ${data}`); -}).catch((err) => { - console.error(`Failed to unlock the screen, because: ${err.message}`); -}); -``` + ```js + screenLock.unlock().then((data) => { + console.info(`Succeeded in unlocking the screen. result: ${data}`); + }).catch((err) => { + console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`); + }); + ``` -## screenlock.lock9+ +## screenLock.lock9+ lock(callback: AsyncCallback<boolean>): void @@ -168,17 +168,17 @@ lock(callback: AsyncCallback<boolean>): void **示例:** -```js -screenlock.lock((err, data) => { + ```js + screenLock.lock((err, data) => { if (err) { - console.error(`Failed to lock the screen, because: ${err.message}`); - return; + console.error(`Failed to lock the screen, Code: ${err.code}, message: ${err.message}`); + return; } - console.info(`lock the screen successfully. result: ${data}`); -}); -``` + console.info(`Succeeded in locking the screen. result: ${data}`); + }); + ``` -## screenlock.lock9+ +## screenLock.lock9+ lock(): Promise<boolean> @@ -204,15 +204,15 @@ lock(): Promise<boolean> **示例:** -```js -screenlock.lock().then((data) => { - console.info(`lock the screen successfully. result: ${data}`); -}).catch((err) => { - console.error(`Failed to lock the screen, because: ${err.message}`); -}); -``` + ```js + screenLock.lock().then((data) => { + console.info(`Succeeded in locking the screen. result: ${data}`); + }).catch((err) => { + console.error(`Failed to lock the screen, Code: ${err.code}, message: ${err.message}`); + }); + ``` -## screenlock.onSystemEvent9+ +## screenLock.onSystemEvent9+ onSystemEvent(callback: Callback<SystemEvent>): boolean @@ -244,17 +244,17 @@ onSystemEvent(callback: Callback<SystemEvent>): boolean **示例:** -```js -try { - let isSuccess = screenlock.onSystemEvent((event) => { - console.log(`Register the system event which related to screenlock successfully. eventType: ${event.eventType}`) + ```js + try { + let isSuccess = screenLock.onSystemEvent((event) => { + console.log(`Succeeded in Registering the system event which related to screenlock. eventType: ${event.eventType}`) }); -} catch (err) { - console.error(`Failed to register the system event which related to screenlock, because: ${err.message}`) -} -``` + } catch (err) { + console.error(`Failed to register the system event which related to screenlock, Code: ${err.code}, message: ${err.message}`) + } + ``` -## screenlock.sendScreenLockEvent9+ +## screenLock.sendScreenLockEvent9+ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback<boolean>): void @@ -282,17 +282,17 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback< **示例:** -```js -screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => { + ```js + screenLock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => { if (err) { - console.error(`Failed to send screenlock event, because: ${err.message}`); - return; + console.error(`Failed to send screenlock event, Code: ${err.code}, message: ${err.message}`); + return; } - console.info(`Send screenlock event successfully. result: ${result}`); -}); -``` + console.info(`Succeeded in Sending screenlock event. result: ${result}`); + }); + ``` -## screenlock.sendScreenLockEvent9+ +## screenLock.sendScreenLockEvent9+ sendScreenLockEvent(event: String, parameter: number): Promise<boolean> @@ -325,15 +325,15 @@ sendScreenLockEvent(event: String, parameter: number): Promise<boolean> **示例:** -```js -screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => { - console.info(`Send screenlock event successfully. result: ${result}`); -}).catch((err) => { - console.error(`Failed to send screenlock event, because: ${err.message}`); -}); -``` + ```js + screenLock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => { + console.info(`Succeeded in Sending screenlock event. result: ${result}`); + }).catch((err) => { + console.error(`Failed to send screenlock event, Code: ${err.code}, message: ${err.message}`); + }); + ``` -## screenlock.isScreenLocked(deprecated) +## screenLock.isScreenLocked(deprecated) isScreenLocked(callback: AsyncCallback<boolean>): void @@ -353,17 +353,17 @@ isScreenLocked(callback: AsyncCallback<boolean>): void **示例:** -```js -screenlock.isScreenLocked((err, data)=>{ + ```js + screenLock.isScreenLocked((err, data)=>{ if (err) { - console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`); - return; + console.error(`Failed to obtain whether the screen is locked, Code: ${err.code}, message: ${err.message}`); + 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(deprecated) +## screenLock.isScreenLocked(deprecated) isScreenLocked(): Promise<boolean> @@ -383,15 +383,15 @@ isScreenLocked(): Promise<boolean> **示例:** -```js -screenlock.isScreenLocked().then((data) => { - console.info(`Obtain whether the screen is locked successfully. result: ${data}`); -}).catch((err) => { - console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`); -}); -``` + ```js + screenLock.isScreenLocked().then((data) => { + console.info(`Succeeded in Obtaining whether the screen is locked. result: ${data}`); + }).catch((err) => { + console.error(`Failed to obtain whether the screen is locked, Code: ${err.code}, message: ${err.message}`); + }); + ``` -## screenlock.isSecureMode(deprecated) +## screenLock.isSecureMode(deprecated) isSecureMode(callback: AsyncCallback<boolean>): void @@ -411,17 +411,17 @@ isSecureMode(callback: AsyncCallback<boolean>): void **示例:** -```js -screenlock.isSecureMode((err, data)=>{ + ```js + screenLock.isSecureMode((err, data)=>{ if (err) { - console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`); - return; + console.error(`Failed to obtain whether the device is in secure mode, Code: ${err.code}, message: ${err.message}`); + 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(deprecated) +## screenLock.isSecureMode(deprecated) isSecureMode(): Promise<boolean> @@ -441,14 +441,15 @@ isSecureMode(): Promise<boolean> **示例:** -```js -screenlock.isSecureMode().then((data) => { - console.info(`Obtain whether the device is in secure mode successfully. result: ${data}`); -}).catch((err) => { - console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`); -}); -``` -## screenlock.unlockScreen(deprecated) + ```js + screenLock.isSecureMode().then((data) => { + console.info(`Succeeded in Obtaining whether the device is in secure mode. result: ${data}`); + }).catch((err) => { + console.error(`Failed to obtain whether the device is in secure mode, Code: ${err.code}, message: ${err.message}`); + }); + ``` + +## screenLock.unlockScreen(deprecated) unlockScreen(callback: AsyncCallback<void>): void @@ -468,17 +469,17 @@ unlockScreen(callback: AsyncCallback<void>): void **示例:** -```js -screenlock.unlockScreen((err) => { + ```js + screenLock.unlockScreen((err) => { if (err) { - console.error(`Failed to unlock the screen, because: ${err.message}`); - return; + console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`); + return; } - console.info('unlock the screen successfully.'); -}); -``` + console.info(`Succeeded unlocking the screen.`); + }); + ``` -## screenlock.unlockScreen(deprecated) +## screenLock.unlockScreen(deprecated) unlockScreen(): Promise<void> @@ -498,10 +499,10 @@ unlockScreen(): Promise<void> **示例:** -```js -screenlock.unlockScreen().then(() => { - console.info('unlock the screen successfully.'); -}).catch((err) => { - console.error(`Failed to unlock the screen, because: ${err.message}`); -}); -``` + ```js + screenLock.unlockScreen().then(() => { + console.info('Succeeded unlocking the screen.'); + }).catch((err) => { + console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`); + }); + ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-stationary.md b/zh-cn/application-dev/reference/apis/js-apis-stationary.md index 14c971750b9df9889c9687e5098411e58b39f489..5fc52b5c242bee82a48f7b7ecaf7551dbaab8c67 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-stationary.md +++ b/zh-cn/application-dev/reference/apis/js-apis-stationary.md @@ -123,7 +123,7 @@ off(activity: ActivityType, event: ActivityEvent, callback?: Callback<Activit | -------------------- | -------------------------------------------------- | ---- | ---------------------------- | | activity | [ActivityType](#activitytype) | 是 | 设备状态能力类型。 | | event | [ActivityEvent](#activityevent) | 是 | 事件类型。 | -| callback | Callback<[ActivityResponse](#activityresponse)\> | 否 | 回调函数,接收上报状态变化事件,如果没有传递callback参数,会移除该进程下订阅该类型得所有callback。 | +| callback | Callback:\<[ActivityResponse](#activityresponse)> | 否 | 回调函数,接收上报状态变化事件。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-usb-deprecated.md b/zh-cn/application-dev/reference/apis/js-apis-usb-deprecated.md index 90a86e2c1b414f4509e807450837cc3952045da0..45ddb853b13f8bb3dc3f5d9b317a7527a7551781 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-usb-deprecated.md +++ b/zh-cn/application-dev/reference/apis/js-apis-usb-deprecated.md @@ -137,9 +137,9 @@ hasRight(deviceName: string): boolean **示例:** ```js -let devicesName="1-1"; +let devicesName= "1-1"; let bool = usb.hasRight(devicesName); -console.log(bool); +console.log(`${bool}`); ``` ## usb.requestRight @@ -165,7 +165,7 @@ requestRight(deviceName: string): Promise<boolean> **示例:** ```js -let devicesName="1-1"; +let devicesName= "1-1"; usb.requestRight(devicesName).then((ret) => { console.log(`requestRight = ${ret}`); }); @@ -375,10 +375,17 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: **示例:** ```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) => { - console.log(`controlTransfer = ${ret}`); -}) + console.log(`controlTransfer = ${ret}`); +}); ``` ## usb.bulkTransfer @@ -413,7 +420,7 @@ bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, tim //把获取到的设备对象作为参数传入usb.connectDevice;当usb.connectDevice接口成功返回之后; //才可以调用第三个接口usb.claimInterface.当usb.claimInterface 调用成功以后,再调用该接口。 usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${ret}`); + console.log(`bulkTransfer = ${ret}`); }); ``` @@ -500,7 +507,7 @@ usbFunctionsToString(funcs: FunctionType): string **示例:** ```js -let funcs = usb.ACM | usb.ECM; +let funcs = usb.FunctionType.ACM | usb.FunctionType.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -529,8 +536,12 @@ setCurrentFunctions(funcs: FunctionType): Promise\ **示例:** ```js -let funcs = usb.HDC; -let ret = usb.setCurrentFunctions(funcs); +let funcs = usb.FunctionType.HDC; +usb.setCurrentFunctions(funcs).then(() => { + console.info('usb setCurrentFunctions successfully.'); +}).catch(err => { + console.error('usb setCurrentFunctions failed: ' + err.code + ' message: ' + err.message); +}); ``` ## usb.getCurrentFunctions9+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-usbManager.md b/zh-cn/application-dev/reference/apis/js-apis-usbManager.md index f9a884db278e3706ceb42e17f9426e2ff2391429..00b14dff37df14583039e937362f7648521ce758 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-usbManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-usbManager.md @@ -531,7 +531,7 @@ usb.requestRight(devicesList[0].name); let devicepipe = usb.connectDevice(devicesList[0]); usb.controlTransfer(devicepipe, param).then((ret) => { console.log(`controlTransfer = ${ret}`); -}) +}); ``` ## usb.bulkTransfer diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md index 5cdfd09f6fa17bf401c6d4baffbc02085b5bb7b4..f12df54e1010753cf2404deb2419d1588a2ecf46 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-window.md +++ b/zh-cn/application-dev/reference/apis/js-apis-window.md @@ -2788,7 +2788,16 @@ class TestRemoteObject extends rpc.RemoteObject { } let token = new TestRemoteObject('testObject'); +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; + }); windowClass.bindDialogTarget(token, () => { console.info('Dialog Window Need Destroy.'); }, (err) => { @@ -2861,7 +2870,16 @@ class TestRemoteObject extends rpc.RemoteObject { } let token = new TestRemoteObject('testObject'); +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 promise = windowClass.bindDialogTarget(token, () => { console.info('Dialog Window Need Destroy.'); }); @@ -2875,6 +2893,172 @@ try { } ``` +### bindDialogTarget9+ + +bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback<void>, callback: AsyncCallback<void>): void + +绑定模态窗口与目标窗口并添加模态窗口销毁监听,使用callback异步回调。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------- | ---- | -------------------- | +| requestInfo | [dialogRequest.RequestInfo](js-apis-app-ability-dialogRequest.md#requestinfo) | 是 | 目标窗口RequestInfo值。 | +| deathCallback | Callback<void> | 是 | 模态窗口销毁监听。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**错误码:** + +以下错误码的详细介绍请参见[窗口错误码](../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'); + } +} +``` + +### bindDialogTarget9+ + +bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback<void>): Promise<void> + +绑定模态窗口与目标窗口并添加模态窗口销毁监听,使用Promise异步回调。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------- | ---- | -------------------- | +| requestInfo | [dialogRequest.RequestInfo](js-apis-app-ability-dialogRequest.md#requestinfo) | 是 | 目标窗口RequestInfo值。 | +| deathCallback | Callback<void> | 是 | 模态窗口销毁监听。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------- | +| Promise<void> | 无返回结果的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'); + } +} +``` + ### isWindowSupportWideGamut9+ isWindowSupportWideGamut(callback: AsyncCallback<boolean>): void diff --git a/zh-cn/application-dev/reference/apis/js-apis-zlib.md b/zh-cn/application-dev/reference/apis/js-apis-zlib.md index f102d9d65874ba5475a8415c13605c6543867f8f..97a026adfd0ceb7b3cb3096ffb08167367eead18 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-zlib.md +++ b/zh-cn/application-dev/reference/apis/js-apis-zlib.md @@ -240,7 +240,7 @@ decompressFile(inFile: string, outFile: string, options: Options, callback: Asyn 以下错误码的详细介绍请参见[ohos.zlib错误码](../errorcodes/errorcode-zlib.md)。 -| 错误码ID | 错误信息 +| 错误码ID | 错误信息 | | -------- | --------------------------------------| | 900001 | The Input source file is invalid. | | 900002 | The Input destination file is invalid. | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md index 80e736caee324873ef1f1e0c7c9e70fc23fd8077..e74cff92233abd2c3818ff43d3f501d08a5f0d84 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md @@ -31,7 +31,7 @@ Toggle(options: { type: ToggleType, isOn?: boolean }) | 名称 | 描述 | | -------- | ---------------- | -| Checkbox | 提供单选框样式。
**说明:**
[通用属性margin](ts-universal-attributes-size.md)的默认值为:
{
 top: 12 px,
 right: 12 px,
 bottom: 12 px,
 left: 12 px
} | +| Checkbox | 提供单选框样式。
**说明:**
[通用属性margin](ts-universal-attributes-size.md)的默认值为:
{
 top: 14 px,
 right: 14 px,
 bottom: 14 px,
 left: 14 px
} | | Button | 提供状态按钮样式,如果子组件有文本设置,则相应的文本内容会显示在按钮内部。 | | Switch | 提供开关样式。
**说明:**
[通用属性margin](ts-universal-attributes-size.md)默认值为:
{
 top: 14 vp,
 right:6 vp,
 bottom: 14 vp,
 left: 6 vp
} | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-component-visible-area-change-event.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-component-visible-area-change-event.md index 69cfb3c75aa80b389630c4905ac4f41167c683e8..fdc7bba31dfad58c98362fed5b58872c89e9f1bb 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-component-visible-area-change-event.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-component-visible-area-change-event.md @@ -11,7 +11,7 @@ | 名称 | 功能描述 | | ---------------------------------------- | ---------------------------------------- | -| onVisibleAreaChange(ratios: Array\, event: (isVisible: boolean, currentRatio: number) => void) | 组件可见区域变化时触发该回调。
-ratios:阈值数组。其中,每个阈值代表组件可见面积(即组件在屏幕显示区的面积)与组件自身面积的比值。当组件可见面积与自身面积的比值大于或小于阈值时,均会触发该回调。每个阈值的取值范围为[0.0, 1.0],如果开发者设置的阈值超出该范围,则会实际取值0.0或1.0.
-isVisible:表示组件的可见面积与自身面积的比值是否大于阈值,true表示大于,false表示小于。
-currentRatio:触发回调时,组件可见面积与自身面积的比值。 | +| onVisibleAreaChange(ratios: Array\, event: (isVisible: boolean, currentRatio: number) => void) | 组件可见区域变化时触发该回调。
-ratios:阈值数组。其中,每个阈值代表组件可见面积(即组件在屏幕显示区的面积)与组件自身面积的比值。当组件可见面积与自身面积的比值大于或小于阈值时,均会触发该回调。每个阈值的取值范围为[0.0, 1.0],如果开发者设置的阈值超出该范围,则会实际取值0.0或1.0.
-isVisible:表示组件的可见面积与自身面积的比值是否大于阈值,true表示大于,false表示小于。
-currentRatio:触发回调时,组件可见面积与自身面积的比值。
**说明:**
该接口只适用于组件布局区域超出或离开了当前屏幕显示区域的情况,不支持组件堆叠(Stack)导致的面积不可见、使用offset或translate等图形变换接口导致的面积超出情况。 | ## 示例 diff --git a/zh-cn/application-dev/security/accesstoken-guidelines.md b/zh-cn/application-dev/security/accesstoken-guidelines.md index 91d35b993aaca0638ab9b794dbc79a7ab69b992b..a2fb6ff574d4c271524b3f614a8707b415602dbf 100644 --- a/zh-cn/application-dev/security/accesstoken-guidelines.md +++ b/zh-cn/application-dev/security/accesstoken-guidelines.md @@ -327,10 +327,4 @@ reqPermissions() { ] } ] -``` - -## 相关实例 - -针对访问控制,有以下相关实例可供参考: - -- [为应用添加运行时权限(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Ability/AccessPermission) \ No newline at end of file +``` \ No newline at end of file diff --git a/zh-cn/application-dev/web/web-app-page-data-channel.md b/zh-cn/application-dev/web/web-app-page-data-channel.md index 27e2ee162c7b4476dce38f650b29273d9a46fc0a..f02e385a3a32f7e09ffbe05e8e793301f73c51de 100644 --- a/zh-cn/application-dev/web/web-app-page-data-channel.md +++ b/zh-cn/application-dev/web/web-app-page-data-channel.md @@ -90,7 +90,14 @@ WebView Message Port Demo - + +

WebView Message Port Demo

+
+
+
+
+

display received message send from ets

+ - - -

WebView Message Port Demo

-
-
-
-
-

display received message send from ets

- ``` diff --git a/zh-cn/device-dev/driver/driver-peripherals-lcd-des.md b/zh-cn/device-dev/driver/driver-peripherals-lcd-des.md index 8167cb3617097d6a990324989389d902cb741778..a46169362a21e2ed94a98388dd437cd1d4eff2e0 100644 --- a/zh-cn/device-dev/driver/driver-peripherals-lcd-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-lcd-des.md @@ -47,7 +47,7 @@ LCD接口通常可分为MIPI DSI接口、TTL接口和LVDS接口,常用的是MI ![image](figures/TTL接口.png "TTL接口") - ​ TTL(Transistor Transistor Logic)即晶体管-晶体管逻辑,TTL电平信号由TTL器件产生,TTL器件是数字集成电路的一大门类,它采用双极型工艺制造,具有高速度、低功耗和品种多等特点。 + ​TTL(Transistor Transistor Logic)即晶体管-晶体管逻辑,TTL电平信号由TTL器件产生,TTL器件是数字集成电路的一大门类,它采用双极型工艺制造,具有高速度、低功耗和品种多等特点。 TTL接口是并行方式传输数据的接口,有数据信号、时钟信号和控制信号(行同步、帧同步、数据有效信号等),在控制信号控制下完成数据传输。通常TTL接口的LCD,内部寄存器读写需要额外的外设接口,比如SPI接口、I2C接口等。 @@ -63,11 +63,13 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony ### 接口说明 +为了能够调整液晶显示屏的各项参数,与display建立显示通道,实现显示器的显示效果,LCD驱动需要通过`display :: host`注册PanelInfo结构体、接口信息,添加描述设备;LcdResetOn读取的pin脚信息,由SampleEntryInit初始化入口函数,并注册器件驱动接口,供平台驱动调用。 + 表1 LCD驱动适配所需接口 | 接口名 | 描述 | | :------------------------------------------------------ | ------------------- | -| display :: host | 设备描述配置 | +| static int32_t MipiDsiInit(struct PanelInfo *info) | 适配对应的芯片平台驱动 | | static int32_t LcdResetOn(void) | 设置Reset Pin脚状态 | | int32_t SampleEntryInit(struct HdfDeviceObject *object) | 器件驱动入口函数 | @@ -78,7 +80,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony 2. 在SoC平台驱动适配层中适配对应的芯片平台驱动。 -3. 添加器件驱动,并在驱动入口函数Init中注册Panel驱动数据,驱动数据接口主要包括如下接口: +3. 添加器件驱动,并在驱动入口函数Init中注册Panel驱动数据,驱动数据接口主要实现下述特性: - LCD上下电 根据LCD硬件连接,使用Platform接口层提供的GPIO操作接口操作对应LCD管脚,例如复位管脚、IOVCC管脚,上电时序参考LCD供应商提供的SPEC。 @@ -87,7 +89,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony 根据LCD硬件接口,使用Platform接口层提供的I2C、SPI、MIPI等接口,下载LCD初始化序列,初始化参数序列可以参考LCD供应商提供的SPEC。 -4. (可选)根据需求实现HDF框架其他接口,比如Release接口。 +4. (可选)根据需求实现HDF框架其他接口。 5. (可选)根据需求使用HDF框架可创建其他设备节点,用于业务逻辑或者调试功能。 @@ -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++ #define RESET_GPIO 5 @@ -204,7 +206,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony #define FRAME_RATE 60 ``` - - 定义PanelInfo结构体 + - 定义PanelInfo结构体(drivers/hdf_core/framework/model/display/driver/hdf_disp.h) ```c++ struct PanelInfo { @@ -225,7 +227,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony }; ``` - - 初始化LCD屏 + - 初始化LCD屏(drivers/hdf_core/framework/model/display/driver/panel/mipi_icn9700.c) ```c++ static uint8_t g_payLoad0[] = { 0xF0, 0x5A, 0x5A }; @@ -257,7 +259,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony static DevHandle g_pwmHandle = NULL; ``` - - 设置Reset Pin脚状态 + - 设置Reset Pin脚状态(/drivers_hdf_core/framework/model/display/driver/panel/mipi_icn9700.c) ```c++ static int32_t LcdResetOn(void) @@ -279,7 +281,7 @@ LCD驱动模型属于驱动基础适配模块,第三方需要适配OpenHarmony } ``` - - 器件驱动入口函数 + - 器件驱动入口函数(/drivers_hdf_core/framework/model/display/driver/panel/mipi_icn9700.c) ```c++ int32_t SampleEntryInit(struct HdfDeviceObject *object) diff --git a/zh-cn/device-dev/get-code/gettools-acquire.md b/zh-cn/device-dev/get-code/gettools-acquire.md index 1d5ad5209743da7148b0010188008b8887c4dd31..2ff65bbf901a8909973efd1c56fe177e8d9f1b82 100644 --- a/zh-cn/device-dev/get-code/gettools-acquire.md +++ b/zh-cn/device-dev/get-code/gettools-acquire.md @@ -13,111 +13,156 @@ OpenHarmony为开发者提供了两种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 | ## 环境准备 -在使用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源码,请参考[获取源码](sourcecode-acquire.md)。 +2. 获取OpenHarmony源码 + + 请参考[获取源码](sourcecode-acquire.md)。 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> HPM Docker环境无需单独获取源码。 -3. 请使用具备root权限的用户,或已被授予docker使用权限的用户进行后续操作。 +3. 获取使用权限 + + 为了能够使用Docker,请使用具备root权限的用户,或已被授予Docker使用权限的用户进行后续操作。在Ubuntu系统中,通常可以通过在命令前加sudo来获取root权限。在Windows系统中,您可能需要在管理员模式下运行cmd或PowerShell。 ## 独立Docker环境 -OpenHarmony的Docker镜像托管在HuaweiCloud SWR上。开发者可以通过该镜像在很大程度上简化编译前的环境配置。下文将介绍具体使用步骤。 +Docker镜像是包含了运行环境和应用程序的轻量级、可执行的软件包,OpenHarmony的Docker镜像托管在HuaweiCloud SWR上。开发者可以通过该镜像在很大程度上简化编译前的环境配置。这一部分将引导您如何在Docker环境中配置和使用OpenHarmony,下文将介绍具体使用步骤。 ### 搭建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 ``` - -2. 进入源码根目录执行如下命令,从而进入Docker构建环境。 - ubuntu下执行: - + 获取轻量系统镜像的命令为: ``` - docker run -it -v $(pwd):/home/openharmony 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_mini:3.2 ``` - windows下执行(假设源码目录为D:\OpenHarmony): +2. 进入Docker构建环境 + + 在获取了镜像之后,您需要创建一个新的Docker容器,并进入该容器中。进入OpenHarmony源码根目录执行如下命令,从而进入Docker构建环境。 + - Ubuntu系统 - ``` - 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 $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_small:3.2 -### 编译源码(轻量系统和小型系统) + # 进入轻量系统Docker构建环境 + docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_mini:3.2 + ``` -通过如下编译脚本启动轻量系统类设备(参考内存≥128KiB)和小型系统类设备(参考内存≥1MiB)的编译。下文以Hi3516平台为例说明具体编译步骤。 + - Windows系统(假设源码目录为`D:\OpenHarmony`): - 设置编译路径,选择当前路径。 - -``` -hb set - . -``` + ``` + # 进入小型系统Docker构建环境 + docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_small:3.2 - **图1** 设置编译界面 + # 进入轻量系统Docker构建环境 + docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_mini:3.2 + ``` - ![zh-cn_image_0000001153508656](figures/zh-cn_image_0000001153508656.png) + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
+ > `docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_small:3.2` 这个命令的含义是,创建并运行一个新的OpenHarmony的Docker容器,这个容器运行在交互模式下,并且将当前目录映射到容器的/home/openharmony目录。 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 当前开发板平台和编译界面的对应关系如下: -> -> - Hi3861:wifiiot_hispark_pegasus\@hisilicon -> -> - Hi3516:ipcamera_hispark_taurus\@hisilicon +### 编译源码(轻量系统和小型系统) +1. 启动编译脚本 -1. 选择ipcamera_hispark_taurus\@hisilicon并回车。 + 执行`docker run`命令进入Docker容器后(此时位于`/home/openharmony`路径下),您可以通过如下编译脚本启动轻量系统类设备(参考内存≥128KiB)和小型系统类设备(参考内存≥1MiB)的编译。 -2. 执行编译。 - ``` - hb build -f + python3 build.py -p {product_name}@{company} ``` -3. 查看编译结果。 - 编译结果文件生成在out/hispark_taurus/ipcamera_hispark_taurus目录下。 + 其中,`{product_name}`为当前版本支持的平台,`{company}`为`{product_name}`对应的公司名。 + + 举个例子,如果您要编译的产品为`hisilicon`下的`ipcamera_hispark_taurus`,您可以输入以下命令来启动编译: -### 搭建Docker环境(标准系统) + ``` + python3 build.py -p ipcamera_hispark_taurus@hisilicon + ``` + + 同样,如果您要编译的产品是`ohemu`下的`qemu_small_system_demo`,那么您可以输入以下命令来启动编译: -1. 获取Docker镜像。 - ``` - docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0 + python3 build.py -p qemu_small_system_demo@ohemu ``` -2. 进入源码根目录执行如下命令,从而进入Docker构建环境。 +2. 查看编译结果 + + 在编译结束后,编译所生成的文件都会被存放在`out/{device_name}/`目录下,结果镜像输出在`out/{device_name}/packages/phone/images/`目录下。 + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
+> 如需退出Docker,执行`exit`命令即可。这个命令会停止当前的Docker容器,并返回到您的操作系统。 + +### 搭建Docker环境(标准系统) + +1. 获取Docker镜像 + + 在搭建标准系统的Docker环境前,我们也需要先获取对应的Docker镜像。具体的命令如下: ``` - docker run -it -v $(pwd):/home/openharmony 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_standard:3.2 ``` +2. 进入Docker构建环境 + + 与之前的步骤相同,我们需要创建一个新的Docker容器,并进入该容器中。进入openharmony源码根目录执行如下命令,从而进入Docker构建环境。 + + - Ubuntu系统 + + ``` + docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_standard:3.2 + ``` + + - Windows系统(假设源码目录为`D:\OpenHarmony`) + + ``` + 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) **说明:**
-> 如需退出Docker,执行exit命令即可。 +> 如需退出Docker,执行`exit`命令即可。这个命令会停止当前的Docker容器,并返回到您的操作系统。 ## 基于HPM的Docker环境 @@ -127,13 +172,16 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件, ### 搭建Docker环境 -1. 初始化安装模板。在任意工作目录中执行以下命令。 +1. 初始化安装模板 + + 在任意工作目录中执行以下命令 ``` hpm init -t @ohos/docker_dist ``` -2. 修改publishAs。 +2. 修改publishAs + 因为获取到的是模板类型的包,要把包的类型改为需要的类型。 在当前目录下打开bundle.json文件,把"publishAs"字段的值由"template"改为"distribution"。 @@ -141,10 +189,10 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件, 执行编译。自动安装docker只能在Ubuntu环境下执行,如果其他环境,需要用户自行安装docker,然后拉取镜像,执行编译。 -- **自动安装docker(Ubuntu环境)**
+- 自动安装docker(Ubuntu环境)
以下命令可以帮助用户自动安装docker, 拉取镜像,并且在容器中开始运行对应解决方案的拉取和编译。 - **方式一:** + 方式一: 命令后接参数指定解决方案,格式如下: @@ -155,7 +203,7 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件, {product}为需编译的解决方案,如:\@ohos/hispark_taurus、\@ohos/hispark_aries、\@ohos/hispark_pegasus。 - **方式二:** + 方式二: 设置环境变量来选择解决方案,再执行编译命令。 @@ -180,7 +228,7 @@ docker_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件, @ohos/hispark_taurus: distribution building completed. ``` -- **自行安装docker(非Ubuntu环境)**
+- 自行安装docker(非Ubuntu环境)
自行安装docker相关操作如下: diff --git a/zh-cn/device-dev/subsystems/subsys-build-component.md b/zh-cn/device-dev/subsystems/subsys-build-component.md index f4d1e4277090ed78e21833f6b3fe37c669e3593d..0ffa21ed29aad083ac328d8f7f0f1d6f9fc44a57 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-component.md +++ b/zh-cn/device-dev/subsystems/subsys-build-component.md @@ -139,9 +139,38 @@ component 示例4:在部件的bundle.json中添加模块配置:test/examples/bundle.json。每个部件都有一个bundle.json配置文件,在部件的根目录下。示例见:[部件的bundle.json](subsys-build-component.md#部件配置规则) -2. 将部件添加到产品配置中。 在产品的配置中添加部件,产品对应的配置文件://vendor/{product_company}/{product-name}/config.json。 - - 在产品配置文件中添加 "subsystem_examples:partA",表示该产品中会编译并打包partA到版本中。 +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到版本中。 3. 编译。 主要有两种编译方式,[命令行方式和hb方式](subsys-build-all.md#编译命令),下面以命令行方式为例: diff --git a/zh-cn/device-dev/subsystems/subsys-build-gn-hap-compilation-guide.md b/zh-cn/device-dev/subsystems/subsys-build-gn-hap-compilation-guide.md index c645347cdbb2a7de6d162e3fd2e62371378fc048..045a09c28d618d7b84963820dfdd08db709dd182 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-gn-hap-compilation-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-build-gn-hap-compilation-guide.md @@ -9,7 +9,7 @@ | Ability | 应用的重要组成部分,是应用所具备能力的抽象。Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个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)。 | -| 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。 | ### 功能简介 diff --git a/zh-cn/device-dev/subsystems/subsys-remote-start.md b/zh-cn/device-dev/subsystems/subsys-remote-start.md deleted file mode 100755 index 0cf26f8b0538e29872aa139f5a22e63220384376..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/subsystems/subsys-remote-start.md +++ /dev/null @@ -1,83 +0,0 @@ -# 分布式远程启动 - - -## 概述 - -分布式任务调度模块,通过主从设备服务代理机制,在OpenHarmony操作系统上建立起分布式服务平台,支持主设备(搭载OpenHarmony的智慧屏设备)启动从设备(IP Camera、运动手表等小内存OpenHarmony设备)FA的能力。 - -以智慧屏节目开播提醒为例,智慧屏上在喜欢的节目菜单中,点击“开播后提醒我”按钮,等节目开播后,智慧屏会拉起运动手表上的节目开播提醒FA。通过该FA用户可以快速知道喜欢的节目已经开始,达到协同互助的作用。 - - -## 基本概念 - -- FA - Feature Ability代表有界面的Ability,用于与用户进行交互。 - -- 远程启动 - 即跨设备启动FA,与本地启动FA相对应。 - - -## 接口说明 - -智慧屏端分布式开放能力如下表,包含在AbilitySlice类中,具体的API接口详见OpenHarmony应用接入接口文档: - - **表1** 分布式远程启动FA的API接口功能介绍 - -| 接口名 | 描述 | -| -------- | -------- | -| void startAbility(Want 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 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为准 - ```