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.
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.
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.
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.
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.
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.
| 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**
...
...
@@ -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. |
| 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
| 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
| 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.
### getMainWindow<sup>9+</sup>
...
...
@@ -5903,9 +5851,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
letwindowClass=null;
...
...
@@ -5949,9 +5897,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
letwindowClass=null;
...
...
@@ -5994,9 +5942,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
try{
...
...
@@ -6037,9 +5985,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
letwindowClass=null;
...
...
@@ -6093,9 +6041,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
letwindowClass=null;
...
...
@@ -6141,9 +6089,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
letwindowClass=null;
...
...
@@ -6185,9 +6133,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
letwindowClass=null;
...
...
@@ -6231,9 +6179,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
storage:LocalStorage
onWindowStageCreate(windowStage){
this.storage=newLocalStorage();
...
...
@@ -6289,9 +6237,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
storage:LocalStorage
onWindowStageCreate(windowStage){
this.storage=newLocalStorage();
...
...
@@ -6340,9 +6288,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
try{
...
...
@@ -6389,9 +6337,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
try{
...
...
@@ -6436,9 +6384,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('onWindowStageCreate');
try{
...
...
@@ -6475,9 +6423,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc
**Example**
```ts
importAbilityfrom'@ohos.application.Ability';
importUIAbilityfrom'@ohos.app.ability.UIAbility';
classmyAbilityextendsAbility{
classmyAbilityextendsUIAbility{
onWindowStageCreate(windowStage){
console.log('disableWindowDecor');
windowStage.disableWindowDecor();
...
...
@@ -6515,9 +6463,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc