Creates a subwindow. This API uses a promise to return the result.
Creates a subwindow. This API uses a promise to return the result.
> **NOTE**
> **NOTE**
>
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9-1) instead.
> 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.
**Model restriction**: This API can be used only in the FA model.
Creates a system window. This API uses a promise to return the result.
Creates a system window. This API uses a promise to return the result.
> **NOTE**
> **NOTE**
>
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9-1) instead.
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9-1) instead.
Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
>
>
> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9) instead.
> 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.
**Model restriction**: This API can be used only in the FA model.
Obtains the top window of the current application. This API uses a promise to return the result.
Obtains the top window of the current application. This API uses a promise to return the result.
> **NOTE**
> **NOTE**
>
>
> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9-1) instead.
> 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.
**Model restriction**: This API can be used only in the FA model.
Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
>
>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9) instead.
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9) instead.
Obtains the top window of the current application. This API uses a promise to return the result.
Obtains the top window of the current application. This API uses a promise to return the result.
> **NOTE**
> **NOTE**
>
>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9-1) instead.
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9-1) instead.
| 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));
| 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));
| 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**
**Error codes**
...
@@ -4136,7 +4084,7 @@ Sets the shadow for the window borders.
...
@@ -4136,7 +4084,7 @@ Sets the shadow for the window borders.
| radius | number | Yes | Radius of the shadow. The value is greater than or equal to 0. The value **0** means that the shadow is disabled for the window borders. |
| radius | number | Yes | Radius of the shadow. The value is 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. |
| 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. |
| 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
...
@@ -5330,7 +5278,7 @@ Sets the background color for this window. This API uses an asynchronous callbac
| 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. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
**Example**
...
@@ -5362,7 +5310,7 @@ Sets the background color for this window. This API uses a promise to return the
...
@@ -5362,7 +5310,7 @@ Sets the background color for this window. This API uses a promise to return the
| 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**
**Return value**
...
@@ -5873,7 +5821,7 @@ Describes the lifecycle of a window stage.
...
@@ -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.
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.
### getMainWindow<sup>9+</sup>
### getMainWindow<sup>9+</sup>
...
@@ -5903,9 +5851,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -5903,9 +5851,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
letwindowClass=null;
letwindowClass=null;
...
@@ -5949,9 +5897,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -5949,9 +5897,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
letwindowClass=null;
letwindowClass=null;
...
@@ -5994,9 +5942,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -5994,9 +5942,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
try{
try{
...
@@ -6037,9 +5985,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6037,9 +5985,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
letwindowClass=null;
letwindowClass=null;
...
@@ -6093,9 +6041,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6093,9 +6041,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
letwindowClass=null;
letwindowClass=null;
...
@@ -6141,9 +6089,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6141,9 +6089,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
letwindowClass=null;
letwindowClass=null;
...
@@ -6185,9 +6133,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6185,9 +6133,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
letwindowClass=null;
letwindowClass=null;
...
@@ -6231,9 +6179,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6231,9 +6179,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
storage:LocalStorage
storage:LocalStorage
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
this.storage=newLocalStorage();
this.storage=newLocalStorage();
...
@@ -6289,9 +6237,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6289,9 +6237,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
storage:LocalStorage
storage:LocalStorage
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
this.storage=newLocalStorage();
this.storage=newLocalStorage();
...
@@ -6340,9 +6288,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6340,9 +6288,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
try{
try{
...
@@ -6389,9 +6337,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6389,9 +6337,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
try{
try{
...
@@ -6436,9 +6384,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6436,9 +6384,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
console.log('onWindowStageCreate');
try{
try{
...
@@ -6475,9 +6423,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6475,9 +6423,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
**Example**
```ts
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
onWindowStageCreate(windowStage){
console.log('disableWindowDecor');
console.log('disableWindowDecor');
windowStage.disableWindowDecor();
windowStage.disableWindowDecor();
...
@@ -6515,9 +6463,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
...
@@ -6515,9 +6463,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc