diff --git a/en/application-dev/reference/apis/js-apis-window.md b/en/application-dev/reference/apis/js-apis-window.md index 375db98333a6932c3dcde8cce453c5e3f4ef6baa..33f56166dd0ba931ceeebc48f506e04e8e8fb661 100644 --- a/en/application-dev/reference/apis/js-apis-window.md +++ b/en/application-dev/reference/apis/js-apis-window.md @@ -146,6 +146,7 @@ Describes a rectangle. Describes the area where the window cannot be displayed. +

Name

Type

@@ -1208,6 +1209,32 @@ Sets whether to keep the screen always on. }); ``` +### setWindowType7+ + +setWindowType(type: WindowType, callback: AsyncCallback<void>): void + +Sets the window type. + +- Parameters + + | Name | Type | Mandatory | Description | + | -------- | ---------------------------------- | --------- | ---------------------------------------- | + | type | [WindowType](#section099619567453) | Yes | Window type. | + | callback | AsyncCallback<void> | Yes | Callback used to return the window type. | + + +- Example + ``` + var type = window.TYPE_APP; + windowClass.setWindowType(type, (err, data) => { + if (err) { + console.error('Failed to set the window type. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the window type. Data: ' + JSON.stringify(data)) + }); + ``` + ## setDimBehind7+ @@ -2206,104 +2233,44 @@ Disables listening for keyboard height changes. windowClass.off(type); ``` +### on('keyboardHeightChange'|'windowSizeChange'7+|'systemAvoidAreaChange'7+) -## on\('keyboardHeightChange'|'windowSizeChange'7+|'systemAvoidAreaChange'7+\) - -on\(type: string, callback: Callback\): void; +on(type: string, callback: Callback<AvoidArea | Size | number>): void Enables listening. -- Parameters +- Parameters - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

type

-

string

-

Yes

-

Listening type.

-
  • keyboardHeightChange: listening for keyboard height changes.
  • windowSizeChange7+: listening for window size changes.
  • systemAvoidAreaChange7+: listening for changes to the area where the window cannot be displayed.
-

callback

-

Callback<AvoidArea | Size | number>

-

Yes

-

Callback used to return the information.

-
+ | Name | Type | Mandatory | Description | + | -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
- **keyboardHeightChange**: listening for keyboard height changes.
- **windowSizeChange'7+**: listening for window size changes.
- **systemAvoidAreaChange'7+**: listening for changes to the area where the window cannot be displayed. | + | callback | Callback<[AvoidArea](#section74393271254) \| [Size](#section695585431120) \| number> | Yes | Callback used to return the information. | -- Example - - ``` - var type = 'windowSizeChange'; - windowClass.on(type, (data) => { - console.info('Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data)); - }); - ``` +- Example + ``` + var type = 'windowSizeChange'; + windowClass.on(type, (data) => { + console.info('Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data)); + }); + ``` -## off\('keyboardHeightChange'|'windowSizeChange'7+|'systemAvoidAreaChange'7+\) +### off('keyboardHeightChange'|'windowSizeChange'7+|'systemAvoidAreaChange'7+) -off\(type: string, callback?: Callback\): void; +off(type: string, callback?: Callback<AvoidArea | Size | number>): void Disables listening. -- Parameters - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

type

-

string

-

Yes

-

Listening type.

-
  • keyboardHeightChange: listening for keyboard height changes.
  • windowSizeChange7+: listening for window size changes.
  • systemAvoidAreaChange7+: listening for changes to the area where the window cannot be displayed.
-

callback

-

Callback<AvoidArea | Size | number>

-

No

-

Callback used to return the information.

-
- -- Example +- Parameters - ``` - var type = 'windowSizeChange'; - windowClass.off(type); - ``` + | Name | Type | Mandatory | Description | + | -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
- **'keyboardHeightChange'**: listening for keyboard height changes.
- **'windowSizeChange'7+**: listening for window size changes.
- **'systemAvoidAreaChange'7+**: listening for changes to the area where the window cannot be displayed. | + | callback | Callback<[AvoidArea](#section74393271254) \| [Size](#section695585431120) \| number> | No | Callback used to return the information. | +- Example + ``` + var type = 'windowSizeChange'; + windowClass.off(type); + ```