diff --git a/en/application-dev/reference/apis/js-apis-screen.md b/en/application-dev/reference/apis/js-apis-screen.md index 22f25f8f0185b954270c2169fc657f0676244623..a05dbe9126609118d08b0bb38c158e38b7fd1b0c 100644 --- a/en/application-dev/reference/apis/js-apis-screen.md +++ b/en/application-dev/reference/apis/js-apis-screen.md @@ -724,8 +724,8 @@ Defines virtual screen parameters. | Name | Type| Readable| Writable| Description | | --------- | -------- | ---- | ---- | ------------------------- | | name | string | Yes | Yes | Name of a virtual screen. | -| width | number | Yes | Yes | Width of the virtual screen. | -| height | number | Yes | Yes | Height of the 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.| @@ -1006,6 +1006,6 @@ 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 | Screen width. | -| height | number | Yes | Yes | Screen height. | +| 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. | diff --git a/en/application-dev/reference/apis/js-apis-window.md b/en/application-dev/reference/apis/js-apis-window.md index 4c5e4fdc59b30f0b411d6fe63c50ccd84d84778b..7cd22e2babd9ada61c3bb72549ca6ef1dfc40cda 100644 --- a/en/application-dev/reference/apis/js-apis-window.md +++ b/en/application-dev/reference/apis/js-apis-window.md @@ -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.| -| top | number | Yes | Yes | Top boundary of the rectangle.| -| width | number | Yes | Yes | Width of the rectangle. | -| height | number | Yes | Yes | Height of the rectangle. | +| 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.| ## AvoidArea7+ @@ -215,8 +215,8 @@ Describes the window size. | Name | Type| Readable| Writable| Description | | ------ | -------- | ---- | ---- | ---------- | -| width | number | Yes | Yes | Window width.| -| height | number | Yes | Yes | Window height.| +| width | number | Yes | Yes | Window width, in pixels.| +| height | number | Yes | Yes | Window height, in pixels.| ## WindowProperties @@ -824,7 +824,7 @@ create(id: string, type: WindowType, callback: AsyncCallback<Window>): voi Creates a subwindow. This API uses an asynchronous callback to return the result. > **NOTE** -> +> > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9) instead. **Model restriction**: This API can be used only in the FA model. @@ -860,7 +860,7 @@ create(id: string, type: WindowType): Promise<Window> Creates a subwindow. This API uses a promise to return the result. > **NOTE** -> +> > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9-1) instead. **Model restriction**: This API can be used only in the FA model. @@ -900,7 +900,7 @@ create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback&l Creates a system window. This API uses an asynchronous callback to return the result. > **NOTE** -> +> > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9) instead. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -936,7 +936,7 @@ create(ctx: BaseContext, id: string, type: WindowType): Promise<Window> Creates a system window. This API uses a promise to return the result. > **NOTE** -> +> > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9-1) instead. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -975,7 +975,7 @@ find(id: string, callback: AsyncCallback<Window>): void Finds a window based on the ID. This API uses an asynchronous callback to return the result. > **NOTE** -> +> > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [findWindow()](#windowfindwindow9) instead. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -1008,7 +1008,7 @@ find(id: string): Promise<Window> Finds a window based on the ID. This API uses a promise to return the result. > **NOTE** -> +> > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [findWindow()](#windowfindwindow9) instead. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -1045,7 +1045,7 @@ getTopWindow(callback: AsyncCallback<Window>): void Obtains the top window of the current application. This API uses an asynchronous callback to return the result. > **NOTE** -> +> > This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9) instead. **Model restriction**: This API can be used only in the FA model. @@ -1079,7 +1079,7 @@ getTopWindow(): Promise<Window> Obtains the top window of the current application. This API uses a promise to return the result. > **NOTE** -> +> > This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9-1) instead. **Model restriction**: This API can be used only in the FA model. @@ -1112,7 +1112,7 @@ getTopWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void Obtains the top window of the current application. This API uses an asynchronous callback to return the result. > **NOTE** -> +> > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9) instead. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -1145,7 +1145,7 @@ getTopWindow(ctx: BaseContext): Promise<Window> Obtains the top window of the current application. This API uses a promise to return the result. > **NOTE** -> +> > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9-1) instead. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -2735,58 +2735,6 @@ try { } ``` -### on('dialogTargetTouch')9+ - -on(type: 'dialogTargetTouch', callback: Callback<void>): void - -Subscribes to click events of the target window in the modal window mode. - -**System capability**: SystemCapability.WindowManager.WindowManager.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'dialogTargetTouch'**, indicating the click event of the target window in the modal window mode.| -| callback | Callback<void>| Yes | Callback invoked when the click event occurs in the target window of the modal window mode.| - -**Example** - -```js -try { - windowClass.on('dialogTargetTouch', () => { - console.info('touch dialog target'); - }); -} catch (exception) { - console.error('Failed to register callback. Cause: ' + JSON.stringify(exception)); -} -``` - -### off('dialogTargetTouch')9+ - -off(type: 'dialogTargetTouch', callback?: Callback<void>): void - -Unsubscribes from click events of the target window in the modal window mode. - -**System capability**: SystemCapability.WindowManager.WindowManager.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ---------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'dialogTargetTouch'**, indicating the click event of the target window in the modal window mode.| -| callback | Callback<void> | No | Callback invoked when the click event occurs in the target window of the modal window mode.| - -**Example** - -```js -try { - windowClass.off('dialogTargetTouch'); -} catch (exception) { - console.error('Failed to unregister callback. Cause: ' + JSON.stringify(exception)); -} -``` - ### bindDialogTarget9+ bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback<void>, callback: AsyncCallback<void>): void @@ -3116,7 +3064,7 @@ Sets the background color for this window. In the stage model, this API must be | Name| Type| Mandatory| Description| | ----- | ------ | -- | ----------------------------------------------------------------------- | -| color | string | Yes| Background color to set. The value is a hexadecimal color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.| +| color | string | Yes| Background color to set. The value is a hexadecimal RGB or aRGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.| **Error codes** @@ -4136,7 +4084,7 @@ Sets the shadow for the window borders. | 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. | -| color | string | No | Color of the shadow. The value is a hexadecimal color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | +| color | string | No | Color of the shadow. The value is a hexadecimal RGB or aRGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | | offsetX | number | No | Offset of the shadow along the x-axis, in pixels. | | offsetY | number | No | Offset of the shadow along the y-axis, in pixels. | @@ -5330,7 +5278,7 @@ Sets the background color for this window. This API uses an asynchronous callbac | Name | Type | Mandatory | Description | | -------- | ------------------------- | --------- | ------------------------------------------------------------ | -| color | string | Yes | Background color to set. The value is a hexadecimal color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | +| color | string | Yes | Background color to set. The value is a hexadecimal RGB or aRGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Example** @@ -5362,7 +5310,7 @@ Sets the background color for this window. This API uses a promise to return the | Name | Type | Mandatory | Description | | ----- | ------ | --------- | ------------------------------------------------------------ | -| color | string | Yes | Background color to set. The value is a hexadecimal color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | +| color | string | Yes | Background color to set. The value is a hexadecimal RGB or aRGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | **Return value** @@ -5873,7 +5821,7 @@ Describes the lifecycle of a window stage. Implements a window manager, which manages each basic window unit, that is, [Window](#window) instance. -Before calling any of the following APIs, you must use [onWindowStageCreate()](js-apis-application-ability.md#abilityonwindowstagecreate) to create a **WindowStage** instance. +Before calling any of the following APIs, you must use [onWindowStageCreate()](js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) to create a **WindowStage** instance. ### getMainWindow9+ @@ -5903,9 +5851,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -5949,9 +5897,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -5994,9 +5942,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try { @@ -6037,9 +5985,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -6093,9 +6041,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -6141,9 +6089,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -6185,9 +6133,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -6231,9 +6179,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { storage : LocalStorage onWindowStageCreate(windowStage) { this.storage = new LocalStorage(); @@ -6289,9 +6237,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { storage : LocalStorage onWindowStageCreate(windowStage) { this.storage = new LocalStorage(); @@ -6340,9 +6288,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try { @@ -6389,9 +6337,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try { @@ -6436,9 +6384,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try { @@ -6475,9 +6423,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('disableWindowDecor'); windowStage.disableWindowDecor(); @@ -6515,9 +6463,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; -class myAbility extends Ability { +class myAbility extends UIAbility { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try {