From 468d2a2c9f81fcc418fd3b09e3eaa46a06f31707 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Sun, 30 Jan 2022 17:04:23 +0800 Subject: [PATCH] update doc Signed-off-by: ester.zhou --- .../reference/apis/js-apis-window.md | 139 +++++++----------- 1 file changed, 53 insertions(+), 86 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-window.md b/en/application-dev/reference/apis/js-apis-window.md index 375db98333..33f56166dd 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); + ``` -- GitLab