提交 d47a65b7 编写于 作者: G ge-yafang

update docs

Signed-off-by: Nge-yafang <geyafang@huawei.com>
上级 95b5bcb5
......@@ -5,7 +5,7 @@
## Modules to Import
```
```js
import window from '@ohos.window';
```
......@@ -15,10 +15,10 @@ Enumerates the window types.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Default Value| Description |
| ----------------- | ------ | ------------------ |
| TYPE_APP | 0 | Application subwindow. |
| TYPE_SYSTEM_ALERT | 1 | System alert window.|
| Name | Default Value | Description |
| ----------------- | ------------- | ---------------------- |
| TYPE_APP | 0 | Application subwindow. |
| TYPE_SYSTEM_ALERT | 1 | System alert window. |
## AvoidAreaType<sup>7+</sup><a name="avoidareatype"></a>
......@@ -26,10 +26,10 @@ Enumerates the types of the area where the window cannot be displayed.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Default Value| Description |
| ----------- | ------ | ------------------ |
| TYPE_SYSTEM | 0 | Default area of the system.|
| TYPE_CUTOUT | 1 | Notch. |
| Name | Default Value | Description |
| ----------- | ------------- | --------------------------- |
| TYPE_SYSTEM | 0 | Default area of the system. |
| TYPE_CUTOUT | 1 | Notch. |
## WindowMode<sup>7+</sup><a name="windowmode"></a>
......@@ -39,13 +39,13 @@ This is a system API and cannot be called by third-party applications.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Default Value| Description |
| ---------- | ------ | ----------------------------- |
| UNDEFINED | 1 | The window mode is not defined by the application. |
| FULLSCREEN | 2 | The application is displayed in full screen. |
| PRIMARY | 3 | The application is displayed in the primary window in split-screen mode. |
| SECONDARY | 4 | The application is displayed in the secondary window in split-screen mode. |
| FLOATING | 5 | The application is displayed in a floating window.|
| Name | Default Value | Description |
| ---------- | ------------- | ------------------------------------------------------------ |
| UNDEFINED | 1 | The window mode is not defined by the application. |
| FULLSCREEN | 2 | The application is displayed in full screen. |
| PRIMARY | 3 | The application is displayed in the primary window in split-screen mode. |
| SECONDARY | 4 | The application is displayed in the secondary window in split-screen mode. |
| FLOATING | 5 | The application is displayed in a floating window. |
## SystemBarProperties<a name="systembarproperties"></a>
......@@ -53,14 +53,14 @@ Describes the properties of the status bar and navigation bar.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type| Readable| Writable| Description |
| -------------------------------------- | -------- | ---- | ---- | ------------------------------------------------------------ |
| statusBarColor | string | Yes | Yes | Background color of the status bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.|
| isStatusBarLightIcon<sup>7+</sup> | boolean | No | Yes | Whether any icon on the status bar is highlighted. |
| statusBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the status bar. |
| navigationBarColor | string | Yes | Yes | Background color of the navigation bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.|
| isNavigationBarLightIcon<sup>7+</sup> | boolean | No | No | Whether any icon on the navigation bar is highlighted. |
| navigationBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the navigation bar. |
| Name | Type | Readable | Writable | Description |
| -------------------------------------- | ------- | -------- | -------- | ------------------------------------------------------------ |
| statusBarColor | string | Yes | Yes | Background color of the status bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**. |
| isStatusBarLightIcon<sup>7+</sup> | boolean | No | Yes | Whether any icon on the status bar is highlighted. |
| statusBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the status bar. |
| navigationBarColor | string | Yes | Yes | Background color of the navigation bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**. |
| isNavigationBarLightIcon<sup>7+</sup> | boolean | No | No | Whether any icon on the navigation bar is highlighted. |
| navigationBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the navigation bar. |
## SystemBarRegionTint<sup>8+</sup><a name="systembartegiontint"></a>
......@@ -70,13 +70,13 @@ This is a system API and cannot be called by third-party applications.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type | Readable| Writable| Description |
| --------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ |
| type | [WindowType](#windowtype) | Yes | Yes | Type of the system bar whose properties are changed. Only the navigation bar and status bar are supported.|
| isEnable | boolean | Yes | Yes | Whether the system bar is displayed. |
| region | [Rect](#rect) | Yes | Yes | Current position and size of the system bar. |
| backgroundColor | string | Yes | Yes | Background color of the system bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.|
| contentColor | string | Yes | Yes | Color of the text on the system bar. |
| Name | Type | Readable | Writable | Description |
| --------------- | ------------------------- | -------- | -------- | ------------------------------------------------------------ |
| type | [WindowType](#windowtype) | Yes | Yes | Type of the system bar whose properties are changed. Only the navigation bar and status bar are supported. |
| isEnable | boolean | Yes | Yes | Whether the system bar is displayed. |
| region | [Rect](#rect) | Yes | Yes | Current position and size of the system bar. |
| backgroundColor | string | Yes | Yes | Background color of the system bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**. |
| contentColor | string | Yes | Yes | Color of the text on the system bar. |
## SystemBarTintState<sup>8+</sup><a name="systembartintstate"></a>
......@@ -86,10 +86,10 @@ This is a system API and cannot be called by third-party applications.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type | Readable| Writable| Description |
| ---------- | -------------------------------------------------- | ---- | ---- | -------------------------- |
| displayId | number | Yes | No | ID of the current physical screen. |
| regionTint | Array<[SystemBarRegionTint](#systembartegiontint)> | Yes | Yes | All system bar information changed.|
| Name | Type | Readable | Writable | Description |
| ---------- | -------------------------------------------------- | -------- | -------- | ----------------------------------- |
| displayId | number | Yes | No | ID of the current physical screen. |
| regionTint | Array<[SystemBarRegionTint](#systembartegiontint)> | Yes | Yes | All system bar information changed. |
## Rect<sup>7+</sup><a name="rect"></a>
......@@ -97,12 +97,12 @@ Describes a rectangle.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| 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. |
| 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. |
## AvoidArea<sup>7+</sup><a name="avoidarea"></a>
......@@ -110,12 +110,12 @@ Describes the area where the window cannot be displayed.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type | Readable| Writable| Description |
| ---------- | ------------- | ---- | ---- | ------------------ |
| leftRect | [Rect](#rect) | Yes | Yes | Rectangle on the left of the screen.|
| topRect | [Rect](#rect) | Yes | Yes | Rectangle at the top of the screen.|
| rightRect | [Rect](#rect) | Yes | Yes | Rectangle on the right of the screen.|
| bottomRect | [Rect](#rect) | Yes | Yes | Rectangle at the bottom of the screen.|
| Name | Type | Readable | Writable | Description |
| ---------- | ------------- | -------- | -------- | -------------------------------------- |
| leftRect | [Rect](#rect) | Yes | Yes | Rectangle on the left of the screen. |
| topRect | [Rect](#rect) | Yes | Yes | Rectangle at the top of the screen. |
| rightRect | [Rect](#rect) | Yes | Yes | Rectangle on the right of the screen. |
| bottomRect | [Rect](#rect) | Yes | Yes | Rectangle at the bottom of the screen. |
## Size<sup>7+</sup><a name="size"></a>
......@@ -123,10 +123,10 @@ Describes the window size.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type| Readable| Writable| Description |
| ------ | -------- | ---- | ---- | ---------- |
| width | number | Yes | Yes | Window width.|
| height | number | Yes | Yes | Window height.|
| Name | Type | Readable | Writable | Description |
| ------ | ------ | -------- | -------- | -------------- |
| width | number | Yes | Yes | Window width. |
| height | number | Yes | Yes | Window height. |
## WindowProperties<a name="windowproperties"></a>
......@@ -134,20 +134,20 @@ Describes the window properties.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type | Readable| Writable| Description |
| ------------------------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ |
| windowRect<sup>7+</sup> | [Rect](#rect) | Yes | Yes | Window size. |
| type<sup>7+</sup> | [WindowType](#windowtype) | Yes | Yes | Window type. |
| isFullScreen | boolean | Yes | Yes | Whether the window is displayed in full screen mode. The default value is **false**. |
| isLayoutFullScreen<sup>7+</sup> | boolean | Yes | Yes | Whether the window layout is in full-screen mode (whether the window is immersive). The default value is **false**. |
| focusable<sup>7+</sup> | boolean | Yes | No | Whether the window can gain focus. The default value is **true**. |
| touchable<sup>7+</sup> | boolean | Yes | No | Whether the window is touchable. The default value is **true**. |
| brightness | number | Yes | Yes | Screen brightness. The value ranges from 0 to 1. The value **1** indicates the maximum brightness.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
| dimBehindValue<sup>7+</sup> | number | Yes | Yes | Dimness of the window that is not on top. The value ranges from 0 to 1. The value **1** indicates the maximum dimness.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
| isKeepScreenOn | boolean | Yes | Yes | Whether the screen is always on. The default value is **false**.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
| isPrivacyMode<sup>7+</sup> | boolean | Yes | Yes | Whether the window is in privacy mode. The default value is **false**.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
| isRoundCorner<sup>7+</sup> | boolean | Yes | Yes | Whether the window has rounded corners.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
| isTransparent<sup>7+</sup> | boolean | Yes | Yes | Whether the window is transparent. The default value is **false**.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
| Name | Type | Readable | Writable | Description |
| ------------------------------- | ------------------------- | -------- | -------- | ------------------------------------------------------------ |
| windowRect<sup>7+</sup> | [Rect](#rect) | Yes | Yes | Window size. |
| type<sup>7+</sup> | [WindowType](#windowtype) | Yes | Yes | Window type. |
| isFullScreen | boolean | Yes | Yes | Whether the window is displayed in full screen mode. The default value is **false**. |
| isLayoutFullScreen<sup>7+</sup> | boolean | Yes | Yes | Whether the window layout is in full-screen mode (whether the window is immersive). The default value is **false**. |
| focusable<sup>7+</sup> | boolean | Yes | No | Whether the window can gain focus. The default value is **true**. |
| touchable<sup>7+</sup> | boolean | Yes | No | Whether the window is touchable. The default value is **true**. |
| brightness | number | Yes | Yes | Screen brightness. The value ranges from 0 to 1. The value **1** indicates the maximum brightness.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. |
| dimBehindValue<sup>7+</sup> | number | Yes | Yes | Dimness of the window that is not on top. The value ranges from 0 to 1. The value **1** indicates the maximum dimness.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. |
| isKeepScreenOn | boolean | Yes | Yes | Whether the screen is always on. The default value is **false**.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. |
| isPrivacyMode<sup>7+</sup> | boolean | Yes | Yes | Whether the window is in privacy mode. The default value is **false**.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. |
| isRoundCorner<sup>7+</sup> | boolean | Yes | Yes | Whether the window has rounded corners.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. |
| isTransparent<sup>7+</sup> | boolean | Yes | Yes | Whether the window is transparent. The default value is **false**.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. |
## ColorSpace<sup>8+</sup><a name="colorspace"></a>
......@@ -155,10 +155,10 @@ Describes the color gamut mode.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Default Value| Description |
| ---------- | ------ | -------------- |
| DEFAULT | 0 | Default color gamut mode.|
| WIDE_GAMUT | 1 | Wide color gamut mode. |
| Name | Default Value | Description |
| ---------- | ------------- | ------------------------- |
| DEFAULT | 0 | Default color gamut mode. |
| WIDE_GAMUT | 1 | Wide color gamut mode. |
## window.create<sup>7+</sup>
......@@ -172,15 +172,15 @@ This API is discarded since API version 8. You are advised to use [window.create
- Parameters
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | -------------------------- |
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the subwindow created.|
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------- | --------- | ---------------------------------------------- |
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the subwindow created. |
- Example
```
```js
var windowClass = null;
window.create("first", window.WindowType.TYPE_APP, (err, data) => {
if (err.code) {
......@@ -205,20 +205,20 @@ This API is discarded since API version 8. You are advised to use [window.create
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- | ---------- |
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type.|
| Name | Type | Mandatory | Description |
| ---- | ------------------------- | --------- | ------------ |
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type. |
- Return value
| Type | Description |
| -------------------------------- | ------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow created.|
| Type | Description |
| -------------------------------- | --------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow created. |
- Example
```
```js
var windowClass = null;
let promise = window.create("first", window.WindowType.TYPE_APP);
promise.then((data)=> {
......@@ -239,16 +239,16 @@ Creates a system window when the context is [ServiceExtensionContext](js-apis-se
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------- | ---- | ---------------------- |
| ctx | [Context](js-apis-service-extension-context.md) | Yes | Current application context. |
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the system window created.|
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------------------- | --------- | -------------------------------------------------- |
| ctx | [Context](js-apis-service-extension-context.md) | Yes | Current application context. |
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the system window created. |
- Example
```
```js
var windowClass = null;
window.create(this.context, "alertWindow", window.WindowType.TYPE_SYSTEM_ALERT, (err, data) => {
if (err.code) {
......@@ -271,21 +271,21 @@ Creates a system window when the context is [ServiceExtensionContext](js-apis-se
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ----------------------------------------------- | ---- | -------------------- |
| ctx | [Context](js-apis-service-extension-context.md) | Yes | Current application context.|
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type. |
| Name | Type | Mandatory | Description |
| ---- | ----------------------------------------------- | --------- | ---------------------------- |
| ctx | [Context](js-apis-service-extension-context.md) | Yes | Current application context. |
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type. |
- Return value
| Type | Description |
| -------------------------------- | ----------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the system window created.|
| Type | Description |
| -------------------------------- | ------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the system window created. |
- Example
```
```js
var windowClass = null;
let promise = window.create(this.context, "alertWindow", window.WindowType.TYPE_SYSTEM_ALERT);
promise.then((data)=> {
......@@ -306,14 +306,14 @@ Finds a window based on the ID. This API uses an asynchronous callback to return
- Parameters
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ---------------------------- |
| id | string | Yes | Window ID. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the window found.|
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------- | --------- | ----------------------------------------- |
| id | string | Yes | Window ID. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the window found. |
- Example
```
```js
var windowClass = null;
window.find("alertWindow", (err, data) => {
if (err.code) {
......@@ -335,19 +335,19 @@ Finds a window based on the ID. This API uses a promise to return the result.
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| id | string | Yes | Window ID.|
| Name | Type | Mandatory | Description |
| ---- | ------ | --------- | ----------- |
| id | string | Yes | Window ID. |
- Return value
| Type | Description |
| -------------------------------- | ----------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the window found.|
| Type | Description |
| -------------------------------- | ---------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the window found. |
- Example
```
```js
var windowClass = null;
let promise = window.find("alertWindow");
promise.then((data)=> {
......@@ -368,13 +368,13 @@ Obtains the top window of the current application. This API uses an asynchronous
- Parameters
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the top window obtained.|
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------- | --------- | ------------------------------------------------ |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the top window obtained. |
- Example
```
```js
var windowClass = null;
window.getTopWindow((err, data) => {
if (err.code) {
......@@ -396,13 +396,13 @@ Obtains the top window of the current application. This API uses a promise to re
- Return value
| Type | Description |
| -------------------------------- | --------------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the top window obtained.|
| Type | Description |
| -------------------------------- | ----------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the top window obtained. |
- Example
```
```js
var windowClass = null;
let promise = window.getTopWindow();
promise.then((data)=> {
......@@ -423,14 +423,14 @@ Obtains the top window of the current application. This API uses an asynchronous
- Parameters
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| ctx | Context | Yes | Current application context. For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md).|
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the top window obtained. |
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------- | --------- | ------------------------------------------------------------ |
| ctx | Context | Yes | Current application context.For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md). |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the top window obtained. |
- Example
```
```js
var windowClass = null;
window.getTopWindow(this.context, (err, data) => {
if (err.code) {
......@@ -452,19 +452,19 @@ Obtains the top window of the current application. This API uses a promise to re
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| ctx | Context | Yes | Current application context. For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md).|
| Name | Type | Mandatory | Description |
| ---- | ------- | --------- | ------------------------------------------------------------ |
| ctx | Context | Yes | Current application context.For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md). |
- Return value
| Type | Description |
| -------------------------------- | --------------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the top window obtained.|
| Type | Description |
| -------------------------------- | ----------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the top window obtained. |
- Example
```
```js
var windowClass = null;
let promise = window.getTopWindow(this.context);
promise.then((data)=> {
......@@ -479,7 +479,7 @@ Obtains the top window of the current application. This API uses a promise to re
on(type: 'systemBarTintChange', callback: Callback&lt;SystemBarTintState&gt;): void
Enables listening for properties changes of the status bar and navigation bar.
Enables listening for the properties changes of the status bar and navigation bar.
This is a system API and cannot be called by third-party applications.
......@@ -487,14 +487,14 @@ This is a system API and cannot be called by third-party applications.
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar.|
| callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | Yes | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | --------------------------------------------------------- | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar. |
| callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | Yes | Callback used to return the information. |
- Example
```
```js
var type = 'systemBarTintChange';
windowClass.on(type, (data) => {
console.info('Succeeded in enabling the listener for systemBarTint changes. Data: ' + JSON.stringify(data));
......@@ -513,14 +513,14 @@ This is a system API and cannot be called by third-party applications.
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar.|
| callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | No | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | --------------------------------------------------------- | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar. |
| callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | No | Callback used to return the information. |
- Example
```
```js
var type = 'systemBarTintChange';
windowClass.off(type);
```
......@@ -541,13 +541,13 @@ This is a system API and cannot be called by third-party applications.
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result.|
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | --------------------------------------------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
windowClass.hide((err, data) => {
if (err.code) {
console.error('Failed to hide the window. Cause: ' + JSON.stringify(err));
......@@ -569,13 +569,13 @@ This is a system API and cannot be called by third-party applications.
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
let promise = windowClass.hide();
promise.then((data)=> {
console.info('window hidden. Data: ' + JSON.stringify(data))
......@@ -594,13 +594,13 @@ Shows this window. This API uses an asynchronous callback to return the result.
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result.|
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | --------------------------------------------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
windowClass.show((err, data) => {
if (err.code) {
console.error('Failed to show the window. Cause: ' + JSON.stringify(err));
......@@ -620,13 +620,13 @@ Shows this window. This API uses a promise to return the result.
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
let promise = windowClass.show();
promise.then((data)=> {
console.info('Succeeded in showing the window. Data: ' + JSON.stringify(data))
......@@ -645,13 +645,13 @@ Destroys this window. This API uses an asynchronous callback to return the resul
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result.|
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | --------------------------------------------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
windowClass.destroy((err, data) => {
if (err.code) {
console.error('Failed to destroy the window. Cause:' + JSON.stringify(err));
......@@ -671,13 +671,13 @@ Destroys this window. This API uses a promise to return the result.
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
let promise = windowClass.destroy();
promise.then((data)=> {
console.info('Succeeded in destroying the window. Data: ' + JSON.stringify(data))
......@@ -696,15 +696,15 @@ Moves the position of this window. This API uses an asynchronous callback to ret
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | --------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right.|
| y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | ------------------------------------------------------------ |
| x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right. |
| y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
windowClass.moveTo(300, 300, (err, data)=>{
if (err.code) {
console.error('Failed to move the window. Cause:' + JSON.stringify(err));
......@@ -725,20 +725,20 @@ Moves the position of this window. This API uses a promise to return the result.
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | --------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right.|
| y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards.|
| Name | Type | Mandatory | Description |
| ---- | ------ | --------- | ------------------------------------------------------------ |
| x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right. |
| y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
let promise = windowClass.moveTo(300, 300);
promise.then((data)=> {
console.info('Window moved. Data: ' + JSON.stringify(data))
......@@ -757,15 +757,15 @@ Changes the size of this window. This API uses an asynchronous callback to retur
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------------- |
| width | number | Yes | New width of the window.|
| height | number | Yes | New height of the window.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | --------------------------------------------- |
| width | number | Yes | New width of the window. |
| height | number | Yes | New height of the window. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
windowClass.resetSize(500, 1000, (err, data) => {
if (err.code) {
console.error('Failed to change the window size. Cause:' + JSON.stringify(err));
......@@ -785,20 +785,20 @@ Changes the size of this window. This API uses a promise to return the result.
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- |
| width | number | Yes | New width of the window.|
| height | number | Yes | New height of the window.|
| Name | Type | Mandatory | Description |
| ------ | ------ | --------- | ------------------------- |
| width | number | Yes | New width of the window. |
| height | number | Yes | New height of the window. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
let promise = windowClass.resetSize(500, 1000);
promise.then((data)=> {
console.info('Window size changed. Data: ' + JSON.stringify(data))
......@@ -819,14 +819,14 @@ This is a system API and cannot be called by third-party applications.
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| type | [WindowType](#windowtype) | Yes | Window type.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result.|
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | --------------------------------------------- |
| type | [WindowType](#windowtype) | Yes | Window type. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var type = window.TYPE_APP;
windowClass.setWindowType(type, (err, data) => {
if (err.code) {
......@@ -849,19 +849,19 @@ This is a system API and cannot be called by third-party applications.
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- | ---------- |
| type | [WindowType](#windowtype) | Yes | Window type.|
| Name | Type | Mandatory | Description |
| ---- | ------------------------- | --------- | ------------ |
| type | [WindowType](#windowtype) | Yes | Window type. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var type = window.TYPE_APP;
let promise = windowClass.setWindowType(type);
promise.then((data)=> {
......@@ -881,13 +881,13 @@ Obtains the properties of this window. This API uses an asynchronous callback to
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------------- | ---- | ------------------ |
| callback | AsyncCallback&lt;[WindowProperties](#windowproperties)&gt; | Yes | Callback used to return the window properties.|
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------------------------- | --------- | ---------------------------------------------- |
| callback | AsyncCallback&lt;[WindowProperties](#windowproperties)&gt; | Yes | Callback used to return the window properties. |
- Example
```
```js
windowClass.getProperties((err, data) => {
if (err.code) {
console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(err));
......@@ -907,9 +907,9 @@ Obtains the properties of this window. This API uses a promise to return the res
- Return value
| Type | Description |
| ---------------------------------------------------- | ------------------------------------- |
| Promise&lt;[WindowProperties](#windowproperties)&gt; | Promise used to return the window properties.|
| Type | Description |
| ---------------------------------------------------- | --------------------------------------------- |
| Promise&lt;[WindowProperties](#windowproperties)&gt; | Promise used to return the window properties. |
- Example
......@@ -932,14 +932,14 @@ Obtains the area where this window cannot be displayed, for example, the system
- Parameters
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch.|
| callback | AsyncCallback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the area. |
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------------- | --------- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch. |
| callback | AsyncCallback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the area. |
- Example
```
```js
var type = window.AvoidAreaType.TYPE_SYSTEM;
windowClass.getAvoidArea(type, (err, data) => {
if (err.code) {
......@@ -960,19 +960,19 @@ Obtains the area where this window cannot be displayed, for example, the system
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch.|
| Name | Type | Mandatory | Description |
| ---- | ------------------------------- | --------- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch. |
- Return value
| Type | Description |
| -------------------------------------- | --------------------------------------------- |
| Promise&lt;[AvoidArea](#avoidarea)&gt; | Promise used to return the area.|
| Type | Description |
| -------------------------------------- | -------------------------------- |
| Promise&lt;[AvoidArea](#avoidarea)&gt; | Promise used to return the area. |
- Example
```
```js
let promise = windowClass.getAvoidArea();
promise.then((data)=> {
console.info('Succeeded in obtaining the area. Data:' + JSON.stringify(data))
......@@ -991,14 +991,14 @@ Sets whether to enable the full-screen mode for this window. This API uses an as
- Parameters
| Name | Type | Mandatory| Description |
| ------------ | ------------------------- | ---- | ---------------------------------------------- |
| isFullScreen | boolean | Yes | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| ------------ | ------------------------- | --------- | ------------------------------------------------------------ |
| isFullScreen | boolean | Yes | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var isFullScreen = true;
windowClass.setFullScreen(isFullScreen, (err, data) => {
if (err.code) {
......@@ -1019,19 +1019,19 @@ Sets whether to enable the full-screen mode for this window. This API uses a pro
- Parameters
| Name | Type | Mandatory| Description |
| ------------ | ------- | ---- | ---------------------------------------------- |
| isFullScreen | boolean | Yes | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden.|
| Name | Type | Mandatory | Description |
| ------------ | ------- | --------- | ------------------------------------------------------------ |
| isFullScreen | boolean | Yes | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var isFullScreen = true;
let promise = windowClass.setFullScreen(isFullScreen);
promise.then((data)=> {
......@@ -1051,14 +1051,14 @@ Sets whether the window layout is in full-screen mode. This API uses an asynchro
- Parameters
| Name | Type | Mandatory| Description |
| ------------------ | ------------------------- | ---- | ------------------------------------------------------------ |
| isLayoutFullScreen | boolean | Yes | Whether the window layout is in full-screen mode, in which the status bar and navigation bar are displayed.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| ------------------ | ------------------------- | --------- | ------------------------------------------------------------ |
| isLayoutFullScreen | boolean | Yes | Whether the window layout is in full-screen mode, in which the status bar and navigation bar are displayed. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var isLayoutFullScreen= true;
windowClass.setLayoutFullScreen(isLayoutFullScreen, (err, data) => {
if (err.code) {
......@@ -1079,19 +1079,19 @@ Sets whether the window layout is in full-screen mode. This API uses a promise t
- Parameters
| Name | Type | Mandatory| Description |
| ------------------ | ------- | ---- | ------------------------------------------------------------ |
| isLayoutFullScreen | boolean | Yes | Whether the window layout is in full-screen mode, in which the status bar and navigation bar are displayed.|
| Name | Type | Mandatory | Description |
| ------------------ | ------- | --------- | ------------------------------------------------------------ |
| isLayoutFullScreen | boolean | Yes | Whether the window layout is in full-screen mode, in which the status bar and navigation bar are displayed. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var isLayoutFullScreen = true;
let promise = windowClass.setLayoutFullScreen(isLayoutFullScreen);
promise.then((data)=> {
......@@ -1111,14 +1111,14 @@ Sets whether to display the status bar and navigation bar in this window. This A
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to **["status", "navigation"]**. By default, they are not displayed.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | ------------------------------------------------------------ |
| names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to **["status", "navigation"]**. By default, they are not displayed. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var names = ["status", "navigation"];
windowClass.setSystemBarEnable(names, (err, data) => {
if (err.code) {
......@@ -1139,19 +1139,19 @@ Sets whether to display the status bar and navigation bar in this window. This A
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ----- | ---- | ------------------------------------------------------------ |
| names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to **["status", "navigation"]**. By default, they are not displayed.|
| Name | Type | Mandatory | Description |
| ----- | ----- | --------- | ------------------------------------------------------------ |
| names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to **["status", "navigation"]**. By default, they are not displayed. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var names = ["status", "navigation"];
let promise = windowClass.setSystemBarEnable(names);
promise.then((data)=> {
......@@ -1171,14 +1171,14 @@ Sets the properties of the status bar and navigation bar in this window. This AP
- Parameters
| Name | Type | Mandatory| Description |
| ------------------- | ------------------------------------------- | ---- | -------------------- |
| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes | Properties of the status bar and navigation bar.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| ------------------- | ------------------------------------------- | --------- | ------------------------------------------------ |
| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes | Properties of the status bar and navigation bar. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var SystemBarProperties={
statusBarColor: '#ff00ff',
navigationBarColor: '#00ff00',
......@@ -1208,19 +1208,19 @@ Sets the properties of the status bar and navigation bar in this window. This AP
- Parameters
| Name | Type | Mandatory| Description |
| ------------------- | ------------------------------------------- | ---- | -------------------- |
| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes | Properties of the status bar and navigation bar.|
| Name | Type | Mandatory | Description |
| ------------------- | ------------------------------------------- | --------- | ------------------------------------------------ |
| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes | Properties of the status bar and navigation bar. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var SystemBarProperties={
statusBarColor: '#ff00ff',
navigationBarColor: '#00ff00',
......@@ -1249,14 +1249,14 @@ Loads content to this window. This API uses an asynchronous callback to return t
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------------- |
| path | string | Yes | Path of the page from which the content will be loaded.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | ------------------------------------------------------- |
| path | string | Yes | Path of the page from which the content will be loaded. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
windowClass.loadContent("pages/page2/page2", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
......@@ -1276,19 +1276,19 @@ Loads content to this window. This API uses a promise to return the result.
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------- |
| path | string | Yes | Path of the page from which the content will be loaded.|
| Name | Type | Mandatory | Description |
| ---- | ------ | --------- | ------------------------------------------------------- |
| path | string | Yes | Path of the page from which the content will be loaded. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
let promise = windowClass.loadContent("pages/page2/page2");
promise.then((data)=> {
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
......@@ -1307,13 +1307,13 @@ Checks whether this window is displayed. This API uses an asynchronous callback
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the window is displayed.|
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | --------- | -------------------------------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the window is displayed. |
- Example
```
```js
windowClass.isShowing((err, data) => {
if (err.code) {
console.error('Failed to check whether the window is showing. Cause:' + JSON.stringify(err));
......@@ -1333,13 +1333,13 @@ Checks whether this window is displayed. This API uses a promise to return the r
- Return value
| Type | Description |
| ---------------------- | ----------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return whether the window is displayed.|
| Type | Description |
| ---------------------- | ------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return whether the window is displayed. |
- Example
```
```js
let promise = windowClass.isShowing();
promise.then((data)=> {
console.info('Succeeded in checking whether the window is showing. Data: ' + JSON.stringify(data))
......@@ -1358,14 +1358,14 @@ Enables listening for window size changes.
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowSizeChange**, which indicates listening for window size changes.|
| callback | Callback&lt;[Size](#size)&gt; | Yes | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | ----------------------------- | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowSizeChange**, which indicates listening for window size changes. |
| callback | Callback&lt;[Size](#size)&gt; | Yes | Callback used to return the information. |
- Example
```
```js
var type = 'windowSizeChange';
windowClass.on(type, (data) => {
console.info('Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data));
......@@ -1382,10 +1382,10 @@ Disables listening for window size changes.
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowSizeChange**, which indicates listening for window size changes.|
| callback | Callback&lt;[Size](#size)&gt; | No | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | ----------------------------- | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowSizeChange<sup>7+</sup>**, which indicates listening for window size changes. |
| callback | Callback&lt;[Size](#size)&gt; | No | Callback used to return the information. |
- Example
......@@ -1404,14 +1404,14 @@ Enables listening for changes to the area where the window cannot be displayed.
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed.|
| callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | --------------------------------------- | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed. |
| callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the information. |
- Example
```
```js
var type = 'systemAvoidAreaChange';
windowClass.on(type, (data) => {
console.info('Succeeded in enabling the listener for system avoid area changes. Data: ' + JSON.stringify(data));
......@@ -1428,10 +1428,10 @@ Disables listening for changes to the area where the window cannot be displayed.
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed.|
| callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | No | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | --------------------------------------- | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed. |
| callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | No | Callback used to return the information. |
- Example
......@@ -1452,14 +1452,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes.|
| callback | Callback&lt;number&gt; | Yes | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes. |
| callback | Callback&lt;number&gt; | Yes | Callback used to return the information. |
- Example
```
```js
var type = 'keyboardHeightChange';
windowClass.on(type, (data) => {
console.info('Succeeded in enabling the listener for keyboard height changes. Data: ' + JSON.stringify(data));
......@@ -1478,10 +1478,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes.|
| callback | Callback&lt;number&gt; | No | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes. |
| callback | Callback&lt;number&gt; | No | Callback used to return the information. |
- Example
......@@ -1500,13 +1500,13 @@ Checks whether this window supports the wide color gamut mode. This API uses an
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the wide color gamut mode is supported.|
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | --------- | ------------------------------------------------------------ |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the wide color gamut mode is supported. |
- Example
```
```js
windowClass.isSupportWideGamut((err, data) => {
if (err.code) {
console.error('Failed to check whether the window support WideGamut. Cause:' + JSON.stringify(err));
......@@ -1526,13 +1526,13 @@ Checks whether this window supports the wide color gamut mode. This API uses a p
- Return value
| Type | Description |
| Type | Description |
| ---------------------- | ------------------------------------------------------------ |
| Promise&lt;boolean&gt; | Promise used to return whether the wide color gamut mode is supported.|
| Promise&lt;boolean&gt; | Promise used to return whether the wide color gamut mode is supported. |
- Example
```
```js
let promise = windowClass.isSupportWideGamut();
promise.then((data)=> {
console.info('Succeeded in checking whether the window support WideGamut. Data: ' + JSON.stringify(data))
......@@ -1551,14 +1551,14 @@ Sets this window to the wide or default color gamut mode. This API uses an async
- Parameters
| Name | Type | Mandatory| Description |
| ---------- | ------------------------- | ---- | ------------ |
| colorSpace | [ColorSpace](#colorspace) | Yes | Color gamut mode.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| ---------- | ------------------------- | --------- | --------------------------------------------- |
| colorSpace | [ColorSpace](#colorspace) | Yes | Color gamut mode. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err, data) => {
if (err.code) {
console.error('Failed to set window colorspace. Cause:' + JSON.stringify(err));
......@@ -1578,19 +1578,19 @@ Sets this window to the wide or default color gamut mode. This API uses a promis
- Parameters
| Name | Type | Mandatory| Description |
| ---------- | ------------------------- | ---- | ------------ |
| colorSpace | [ColorSpace](#colorspace) | Yes | Color gamut mode.|
| Name | Type | Mandatory | Description |
| ---------- | ------------------------- | --------- | ----------------- |
| colorSpace | [ColorSpace](#colorspace) | Yes | Color gamut mode. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
let promise = windowClass.isSupportWideGamut(window.ColorSpace.WIDE_GAMUT);
promise.then((data)=> {
console.info('Succeeded in setting window colorspace. Data: ' + JSON.stringify(data))
......@@ -1609,13 +1609,13 @@ Obtains the color gamut mode of this window. This API uses an asynchronous callb
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | -------------------------- |
| callback | AsyncCallback&lt;[ColorSpace](#colorspace)&gt; | Yes | Callback used to return the color gamut mode obtained.|
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------------- | --------- | ------------------------------------------------------ |
| callback | AsyncCallback&lt;[ColorSpace](#colorspace)&gt; | Yes | Callback used to return the color gamut mode obtained. |
- Example
```
```js
windowClass.getColorSpace((err, data) => {
if (err.code) {
console.error('Failed to get window color space. Cause:' + JSON.stringify(err));
......@@ -1635,13 +1635,13 @@ Obtains the color gamut mode of this window. This API uses a promise to return t
- Return value
| Type | Description |
| ---------------------------------------- | ----------------------------------------- |
| Promise&lt;[ColorSpace](#colorspace)&gt; | Promise used to return the color gamut mode obtained.|
| Type | Description |
| ---------------------------------------- | ----------------------------------------------------- |
| Promise&lt;[ColorSpace](#colorspace)&gt; | Promise used to return the color gamut mode obtained. |
- Example
```
```js
let promise = windowClass.getColorSpace();
promise.then((data)=> {
console.info('Succeeded in getting window color space. Cause:' + JSON.stringify(data))
......@@ -1662,14 +1662,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | ------------------------------------------------------------ |
| color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var color = '#00ff33';
windowClass.setBackgroundColor(color, (err, data) => {
if (err.code) {
......@@ -1692,19 +1692,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00.|
| Name | Type | Mandatory | Description |
| ----- | ------ | --------- | ------------------------------------------------------------ |
| color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var color = '#00ff33';
let promise = windowClass.setBackgroundColor(color);
promise.then((data)=> {
......@@ -1726,14 +1726,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| ---------- | ------------------------- | ---- | ------------------------------------ |
| brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| ---------- | ------------------------- | --------- | ------------------------------------------------------------ |
| brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var brightness = 1;
windowClass.setBrightness(brightness, (err, data) => {
if (err.code) {
......@@ -1756,19 +1756,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | ------------------------------------ |
| brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.|
| Name | Type | Mandatory | Description |
| ---------- | ------ | --------- | ------------------------------------------------------------ |
| brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var brightness = 1;
let promise = windowClass.setBrightness(brightness);
promise.then((data)=> {
......@@ -1790,14 +1790,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| -------------- | ------------------------- | ---- | -------------------------------------------------- |
| dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| -------------- | ------------------------- | --------- | ------------------------------------------------------------ |
| dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
windowClass.setDimBehind(0.5, (err, data) => {
if (err.code) {
console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
......@@ -1819,19 +1819,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | -------------------------------------------------- |
| dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.|
| Name | Type | Mandatory | Description |
| -------------- | ------ | --------- | ------------------------------------------------------------ |
| dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
let promise = windowClass.setDimBehind(0.5);
promise.then((data)=> {
console.info('Succeeded in setting the dimness. Data: ' + JSON.stringify(data))
......@@ -1852,14 +1852,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| ----------- | ------------------------- | ---- | ---------------------------- |
| isFocusable | boolean | Yes | Whether the window can gain focus.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| ----------- | ------------------------- | --------- | --------------------------------------------- |
| isFocusable | boolean | Yes | Whether the window can gain focus. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var isFocusable= true;
windowClass.setFocusable(isFocusable, (err, data) => {
if (err.code) {
......@@ -1882,19 +1882,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| ----------- | ------- | ---- | ---------------------------- |
| isFocusable | boolean | Yes | Whether the window can gain focus.|
| Name | Type | Mandatory | Description |
| ----------- | ------- | --------- | ---------------------------------- |
| isFocusable | boolean | Yes | Whether the window can gain focus. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var isFocusable= true;
let promise = windowClass.setFocusable(isFocusable);
promise.then((data)=> {
......@@ -1916,14 +1916,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| -------------- | ------------------------- | ---- | ------------------------ |
| isKeepScreenOn | boolean | Yes | Whether to keep the screen always on.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| -------------- | ------------------------- | --------- | --------------------------------------------- |
| isKeepScreenOn | boolean | Yes | Whether to keep the screen always on. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var isKeepScreenOn = true;
windowClass.setKeepScreenOn(isKeepScreenOn, (err, data) => {
if (err.code) {
......@@ -1946,19 +1946,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| -------------- | ------- | ---- | ------------------------ |
| isKeepScreenOn | boolean | Yes | Whether to keep the screen always on.|
| Name | Type | Mandatory | Description |
| -------------- | ------- | --------- | ------------------------------------- |
| isKeepScreenOn | boolean | Yes | Whether to keep the screen always on. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var isKeepScreenOn= true;
let promise = windowClass.setKeepScreenOn(isKeepScreenOn);
promise.then((data)=> {
......@@ -1980,14 +1980,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ---------------- |
| touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| --------- | ------------------------- | --------- | ------------------------------------------------------------ |
| touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
windowClass.setOutsideTouchable(true, (err, data) => {
if (err.code) {
console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
......@@ -2009,19 +2009,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| --------- | ------- | ---- | ---------------- |
| touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite.|
| Name | Type | Mandatory | Description |
| --------- | ------- | --------- | ------------------------------------------------------------ |
| touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
let promise = windowClass.setOutsideTouchable(true);
promise.then((data)=> {
console.info('Succeeded in setting the area to be touchable. Data: ' + JSON.stringify(data))
......@@ -2042,14 +2042,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| ------------- | ------------------------- | ---- | -------------------- |
| isPrivacyMode | boolean | Yes | Whether the window is in privacy mode.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| ------------- | ------------------------- | --------- | --------------------------------------------- |
| isPrivacyMode | boolean | Yes | Whether the window is in privacy mode. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var isPrivacyMode = true;
windowClass.setPrivacyMode(isPrivacyMode, (err, data) => {
if (err.code) {
......@@ -2073,19 +2073,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| ------------- | ------- | ---- | -------------------- |
| isPrivacyMode | boolean | Yes | Whether the window is in privacy mode.|
| Name | Type | Mandatory | Description |
| ------------- | ------- | --------- | -------------------------------------- |
| isPrivacyMode | boolean | Yes | Whether the window is in privacy mode. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var isPrivacyMode = true;
let promise = windowClass.setPrivacyMode(isPrivacyMode);
promise.then((data)=> {
......@@ -2107,14 +2107,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| ----------- | ------------------------- | ---- | -------------------- |
| isTouchable | boolean | Yes | Whether the window is touchable.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| ----------- | ------------------------- | --------- | --------------------------------------------- |
| isTouchable | boolean | Yes | Whether the window is touchable. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```js
var isTouchable = true;
windowClass.setTouchable(isTouchable, (err, data) => {
if (err.code) {
......@@ -2138,19 +2138,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
- Parameters
| Name | Type | Mandatory| Description |
| ----------- | ------- | ---- | -------------------- |
| isTouchable | boolean | Yes | Whether the window is touchable.|
| Name | Type | Mandatory | Description |
| ----------- | ------- | --------- | -------------------------------- |
| isTouchable | boolean | Yes | Whether the window is touchable. |
- Return value
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
| Type | Description |
| ------------------- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result. |
- Example
```
```js
var isTouchable = true;
let promise = windowClass.setTouchable(isTouchable);
promise.then((data)=> {
......@@ -2166,12 +2166,12 @@ Describes the lifecycle of a window stage.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Default Value| Description |
| ---------- | ------ | -------- |
| FOREGROUND | 1 | The window stage is running in the foreground.|
| ACTIVE | 2 | The window stage gains focus.|
| INACTIVE | 3 | The window stage loses focus.|
| BACKGROUND | 4 | The window stage is running in the background.|
| Name | Default Value | Description |
| ---------- | ------------- | ---------------------------------------------- |
| FOREGROUND | 1 | The window stage is running in the foreground. |
| ACTIVE | 2 | The window stage gains focus. |
| INACTIVE | 3 | The window stage loses focus. |
| BACKGROUND | 4 | The window stage is running in the background. |
## WindowStage<sup>9+</sup>
......@@ -2187,13 +2187,13 @@ Obtains the main window of this window stage. This API uses a promise to return
- Return value
| Type | Description |
| -------------------------------- | ---------------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the main window.|
| Type | Description |
| -------------------------------- | --------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the main window. |
- Example
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2219,13 +2219,13 @@ Obtains the main window of this window stage. This API uses an asynchronous call
- Parameters
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | --------------------------------------- |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the main window.|
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------- | --------- | ---------------------------------------- |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the main window. |
- Example
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2249,19 +2249,22 @@ createSubWindow(name: string): Promise&lt;Window&gt;
Creates a subwindow for this window stage. This API uses a promise to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------- |
| name | String | Yes | Name of the subwindow.|
| Name | Type | Mandatory | Description |
| ---- | ------ | --------- | ---------------------- |
| name | String | Yes | Name of the subwindow. |
- Return value
| Type | Description |
| -------------------------------- | ------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow created.|
| Type | Description |
| -------------------------------- | --------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow created. |
- Example
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2287,14 +2290,14 @@ Creates a subwindow for this window stage. This API uses an asynchronous callbac
- Parameters
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------ |
| name | String | Yes | Name of the subwindow. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the subwindow created.|
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------- | --------- | ---------------------------------------------- |
| name | String | Yes | Name of the subwindow. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the subwindow created. |
- Example
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2319,15 +2322,16 @@ getSubWindow(): Promise&lt;Array&lt;Window&gt;&gt;
Obtains all the subwindows of this window stage. This API uses a promise to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
| Type | Description |
| --------------------------------------------- | ------------------------------------------------------------ |
| Promise&lt;Array&lt;[Window](#window)&gt;&gt; | Promise used to return all the subwindows.|
| Type | Description |
| --------------------------------------------- | ------------------------------------------ |
| Promise&lt;Array&lt;[Window](#window)&gt;&gt; | Promise used to return all the subwindows. |
- Example
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2350,15 +2354,16 @@ getSubWindow(callback: AsyncCallback&lt;Array&lt;Window&gt;&gt;): void
Obtains all the subwindows of this window stage. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ---- | ------------------------------------------- |
| callback | AsyncCallback&lt;Array&lt;[Window](#window)&gt;&gt; | Yes | Callback used to return all the subwindows.|
| Name | Type | Mandatory | Description |
| -------- | --------------------------------------------------- | --------- | ------------------------------------------- |
| callback | AsyncCallback&lt;Array&lt;[Window](#window)&gt;&gt; | Yes | Callback used to return all the subwindows. |
- Example
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2385,14 +2390,14 @@ Loads content to this window stage. This API uses an asynchronous callback to re
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------------- |
| path | string | Yes | Path of the page from which the content will be loaded.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | --------- | ------------------------------------------------------- |
| path | string | Yes | Path of the page from which the content will be loaded. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2406,6 +2411,7 @@ Loads content to this window stage. This API uses an asynchronous callback to re
}
}
```
### on('windowStageEvent')<sup>9+</sup>
on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void
......@@ -2413,16 +2419,17 @@ on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;
Enables listening for window stage lifecycle changes.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowStageEvent**, which indicates listening for window stage lifecycle changes.|
| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | Yes | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowStageEvent**, which indicates listening for window stage lifecycle changes. |
| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | Yes | Callback used to return the information. |
- Example
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2441,15 +2448,17 @@ off(eventType: 'windowStageEvent', callback?: Callback&lt;WindowStageEventType&g
Disables listening for window stage lifecycle changes.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowStageEvent**, which indicates listening for window stage lifecycle changes.|
| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | No | Callback used to return the information. |
| Name | Type | Mandatory | Description |
| -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowStageEvent**, which indicates listening for window stage lifecycle changes. |
| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | No | Callback used to return the information. |
- Example
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......
......@@ -2,10 +2,11 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
## 导入模块
```
```js
import window from '@ohos.window';
```
......@@ -180,7 +181,7 @@ create(id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): voi
- 示例
```
```js
var windowClass = null;
window.create("first", window.WindowType.TYPE_APP, (err, data) => {
if (err.code) {
......@@ -218,7 +219,7 @@ create(id: string, type: WindowType): Promise&lt;Window&gt;
- 示例
```
```js
var windowClass = null;
let promise = window.create("first", window.WindowType.TYPE_APP);
promise.then((data)=> {
......@@ -233,22 +234,24 @@ create(id: string, type: WindowType): Promise&lt;Window&gt;
create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): void
当Context为[ServiceExtensionContext](js-apis-service-extension-context.md)时,创建系统窗口,使用callback方式作为异步方法。
创建子窗口,使用callback方式作为异步方法,其中Context详见[Context](js-apis-Context.md)
从API version 9开始,当Context为[ServiceExtensionContext](js-apis-service-extension-context.md)时,创建系统窗口,使用callback方式作为异步方法。
**系统能力**:SystemCapability.WindowManager.WindowManager.Core
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------- | ---- | ---------------------- |
| ctx | [Context](js-apis-service-extension-context.md) | 是 | 当前应用上下文信息。 |
| id | string | 是 | 窗口id。 |
| type | [WindowType](#windowtype) | 是 | 窗口类型。 |
| callback | AsyncCallback&lt;[Window](#window)&gt; | 是 | 回调返回当前窗口对象。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| ctx | Context | 是 | 当前应用上下文信息。<br>API version 8的Context定义见[Context](js-apis-Context.md)<br>API version 9的Context定义见[Context](js-apis-service-extension-context.md) |
| id | string | 是 | 窗口id。 |
| type | [WindowType](#windowtype) | 是 | 窗口类型。 |
| callback | AsyncCallback&lt;[Window](#window)&gt; | 是 | 回调返回当前窗口对象。 |
- 示例
```
```js
var windowClass = null;
window.create(this.context, "alertWindow", window.WindowType.TYPE_SYSTEM_ALERT, (err, data) => {
if (err.code) {
......@@ -265,17 +268,19 @@ create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback&lt;Wi
create(ctx: Context, id: string, type: WindowType): Promise&lt;Window&gt;
当Context为[ServiceExtensionContext](js-apis-service-extension-context.md)时,创建系统窗口,使用Promise方式作为异步方法。
创建子窗口,使用Promise方式作为异步方法,其中Context详见[Context](js-apis-Context.md)
从API version 9开始,当Context为[ServiceExtensionContext](js-apis-service-extension-context.md)时,创建系统窗口,使用Promise方式作为异步方法。
**系统能力**:SystemCapability.WindowManager.WindowManager.Core
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------------------------- | ---- | -------------------- |
| ctx | [Context](js-apis-service-extension-context.md) | 是 | 当前应用上下文信息。 |
| id | string | 是 | 窗口id。 |
| type | [WindowType](#windowtype) | 是 | 窗口类型。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------------------- | ---- | ------------------------------------------------------------ |
| ctx | Context | 是 | 当前应用上下文信息。<br/>API version 8的Context定义见[Context](js-apis-Context.md)<br/>API version 9的Context定义见[Context](js-apis-service-extension-context.md)。 |
| id | string | 是 | 窗口id。 |
| type | [WindowType](#windowtype) | 是 | 窗口类型。 |
- 返回值
......@@ -285,7 +290,7 @@ create(ctx: Context, id: string, type: WindowType): Promise&lt;Window&gt;
- 示例
```
```js
var windowClass = null;
let promise = window.create(this.context, "alertWindow", window.WindowType.TYPE_SYSTEM_ALERT);
promise.then((data)=> {
......@@ -313,7 +318,7 @@ find(id: string, callback: AsyncCallback&lt;Window&gt;): void
- 示例
```
```js
var windowClass = null;
window.find("alertWindow", (err, data) => {
if (err.code) {
......@@ -347,7 +352,7 @@ find(id: string): Promise&lt;Window&gt;
- 示例
```
```js
var windowClass = null;
let promise = window.find("alertWindow");
promise.then((data)=> {
......@@ -374,7 +379,7 @@ getTopWindow(callback: AsyncCallback&lt;Window&gt;): void
- 示例
```
```js
var windowClass = null;
window.getTopWindow((err, data) => {
if (err.code) {
......@@ -402,7 +407,7 @@ getTopWindow(): Promise&lt;Window&gt;
- 示例
```
```js
var windowClass = null;
let promise = window.getTopWindow();
promise.then((data)=> {
......@@ -425,12 +430,12 @@ getTopWindow(ctx: Context, callback: AsyncCallback&lt;Window&gt;): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| ctx | Context | 是 | 当前应用上下文信息。API8的Context定义见[Context](js-apis-Context.md)。API9的Context定义见[Context](js-apis-ability-context.md)。 |
| ctx | Context | 是 | 当前应用上下文信息。<br>API version 8的Context定义见[Context](js-apis-Context.md)<br>API version 9的Context定义见[Context](js-apis-ability-context.md)。 |
| callback | AsyncCallback&lt;[Window](#window)&gt; | 是 | 回调返回当前应用内最后显示的窗口对象。 |
- 示例
```
```js
var windowClass = null;
window.getTopWindow(this.context, (err, data) => {
if (err.code) {
......@@ -454,7 +459,7 @@ getTopWindow(ctx: Context): Promise&lt;Window&gt;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| ctx | Context | 是 | 当前应用上下文信息。API8的Context定义见[Context](js-apis-Context.md)。API9的Context定义见[Context](js-apis-ability-context.md)。 |
| ctx | Context | 是 | 当前应用上下文信息。<br/>API version 8的Context定义见[Context](js-apis-Context.md)<br/>API version 9的Context定义见[Context](js-apis-ability-context.md)。 |
- 返回值
......@@ -464,7 +469,7 @@ getTopWindow(ctx: Context): Promise&lt;Window&gt;
- 示例
```
```js
var windowClass = null;
let promise = window.getTopWindow(this.context);
promise.then((data)=> {
......@@ -494,7 +499,7 @@ on(type: 'systemBarTintChange', callback: Callback&lt;SystemBarTintState&gt;): v
- 示例
```
```js
var type = 'systemBarTintChange';
windowClass.on(type, (data) => {
console.info('Succeeded in enabling the listener for systemBarTint changes. Data: ' + JSON.stringify(data));
......@@ -520,7 +525,7 @@ off(type: 'systemBarTintChange', callback?: Callback&lt;SystemBarTintState &gt;)
- 示例
```
```js
var type = 'systemBarTintChange';
windowClass.off(type);
```
......@@ -547,7 +552,7 @@ hide (callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
windowClass.hide((err, data) => {
if (err.code) {
console.error('Failed to hide the window. Cause: ' + JSON.stringify(err));
......@@ -575,7 +580,7 @@ hide(): Promise&lt;void&gt;
- 示例
```
```js
let promise = windowClass.hide();
promise.then((data)=> {
console.info('window hidden. Data: ' + JSON.stringify(data))
......@@ -600,7 +605,7 @@ show(callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
windowClass.show((err, data) => {
if (err.code) {
console.error('Failed to show the window. Cause: ' + JSON.stringify(err));
......@@ -626,7 +631,7 @@ show(): Promise&lt;void&gt;
- 示例
```
```js
let promise = windowClass.show();
promise.then((data)=> {
console.info('Succeeded in showing the window. Data: ' + JSON.stringify(data))
......@@ -651,7 +656,7 @@ destroy(callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
windowClass.destroy((err, data) => {
if (err.code) {
console.error('Failed to destroy the window. Cause:' + JSON.stringify(err));
......@@ -677,7 +682,7 @@ destroy(): Promise&lt;void&gt;
- 示例
```
```js
let promise = windowClass.destroy();
promise.then((data)=> {
console.info('Succeeded in destroying the window. Data: ' + JSON.stringify(data))
......@@ -704,7 +709,7 @@ moveTo(x: number, y: number, callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
windowClass.moveTo(300, 300, (err, data)=>{
if (err.code) {
console.error('Failed to move the window. Cause:' + JSON.stringify(err));
......@@ -738,7 +743,7 @@ moveTo(x: number, y: number): Promise&lt;void&gt;
- 示例
```
```js
let promise = windowClass.moveTo(300, 300);
promise.then((data)=> {
console.info('Window moved. Data: ' + JSON.stringify(data))
......@@ -765,7 +770,7 @@ resetSize(width: number, height: number, callback: AsyncCallback&lt;void&gt;): v
- 示例
```
```js
windowClass.resetSize(500, 1000, (err, data) => {
if (err.code) {
console.error('Failed to change the window size. Cause:' + JSON.stringify(err));
......@@ -798,7 +803,7 @@ resetSize(width: number, height: number): Promise&lt;void&gt;
- 示例
```
```js
let promise = windowClass.resetSize(500, 1000);
promise.then((data)=> {
console.info('Window size changed. Data: ' + JSON.stringify(data))
......@@ -826,7 +831,7 @@ setWindowType(type: WindowType, callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
var type = window.TYPE_APP;
windowClass.setWindowType(type, (err, data) => {
if (err.code) {
......@@ -861,7 +866,7 @@ setWindowType(type: WindowType): Promise&lt;void&gt;
- 示例
```
```js
var type = window.TYPE_APP;
let promise = windowClass.setWindowType(type);
promise.then((data)=> {
......@@ -887,7 +892,7 @@ getProperties(callback: AsyncCallback&lt;WindowProperties&gt;): void
- 示例
```
```js
windowClass.getProperties((err, data) => {
if (err.code) {
console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(err));
......@@ -913,7 +918,7 @@ getProperties(): Promise&lt;WindowProperties&gt;
- 示例
```
```js
let promise = windowClass.getProperties();
promise.then((data)=> {
console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data))
......@@ -939,7 +944,7 @@ getAvoidArea(type: AvoidAreaType, callback: AsyncCallback&lt;AvoidArea&gt;): voi
- 示例
```
```js
var type = window.AvoidAreaType.TYPE_SYSTEM;
windowClass.getAvoidArea(type, (err, data) => {
if (err.code) {
......@@ -972,7 +977,7 @@ getAvoidArea(type: AvoidAreaType): Promise&lt;AvoidArea&gt;
- 示例
```
```js
let promise = windowClass.getAvoidArea();
promise.then((data)=> {
console.info('Succeeded in obtaining the area. Data:' + JSON.stringify(data))
......@@ -998,7 +1003,7 @@ setFullScreen(isFullScreen: boolean, callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
var isFullScreen = true;
windowClass.setFullScreen(isFullScreen, (err, data) => {
if (err.code) {
......@@ -1031,7 +1036,7 @@ setFullScreen(isFullScreen: boolean): Promise&lt;void&gt;
- 示例
```
```js
var isFullScreen = true;
let promise = windowClass.setFullScreen(isFullScreen);
promise.then((data)=> {
......@@ -1058,7 +1063,7 @@ setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback&lt;void
- 示例
```
```js
var isLayoutFullScreen= true;
windowClass.setLayoutFullScreen(isLayoutFullScreen, (err, data) => {
if (err.code) {
......@@ -1091,7 +1096,7 @@ setLayoutFullScreen(isLayoutFullScreen: boolean): Promise&lt;void&gt;
- 示例
```
```js
var isLayoutFullScreen = true;
let promise = windowClass.setLayoutFullScreen(isLayoutFullScreen);
promise.then((data)=> {
......@@ -1118,7 +1123,7 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallbac
- 示例
```
```js
var names = ["status", "navigation"];
windowClass.setSystemBarEnable(names, (err, data) => {
if (err.code) {
......@@ -1151,7 +1156,7 @@ setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise&lt;void&gt;
- 示例
```
```js
var names = ["status", "navigation"];
let promise = windowClass.setSystemBarEnable(names);
promise.then((data)=> {
......@@ -1178,7 +1183,7 @@ setSystemBarProperties(systemBarProperties: SystemBarProperties, callback: Async
- 示例
```
```js
var SystemBarProperties={
statusBarColor: '#ff00ff',
navigationBarColor: '#00ff00',
......@@ -1220,7 +1225,7 @@ setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise&lt;voi
- 示例
```
```js
var SystemBarProperties={
statusBarColor: '#ff00ff',
navigationBarColor: '#00ff00',
......@@ -1253,10 +1258,10 @@ loadContent(path: string, callback: AsyncCallback&lt;void&gt;): void
| -------- | ------------------------- | ---- | -------------------- |
| path | string | 是 | 设置加载页面的路径。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
- 示例
```
```js
windowClass.loadContent("pages/page2/page2", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
......@@ -1279,7 +1284,7 @@ loadContent(path: string): Promise&lt;void&gt;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------- |
| path | string | 是 | 设置加载页面的路径。 |
- 返回值
| 类型 | 说明 |
......@@ -1288,7 +1293,7 @@ loadContent(path: string): Promise&lt;void&gt;
- 示例
```
```js
let promise = windowClass.loadContent("pages/page2/page2");
promise.then((data)=> {
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
......@@ -1313,7 +1318,7 @@ isShowing(callback: AsyncCallback&lt;boolean&gt;): void
- 示例
```
```js
windowClass.isShowing((err, data) => {
if (err.code) {
console.error('Failed to check whether the window is showing. Cause:' + JSON.stringify(err));
......@@ -1339,7 +1344,7 @@ isShowing(): Promise&lt;boolean&gt;
- 示例
```
```js
let promise = windowClass.isShowing();
promise.then((data)=> {
console.info('Succeeded in checking whether the window is showing. Data: ' + JSON.stringify(data))
......@@ -1365,7 +1370,7 @@ on(type: 'windowSizeChange', callback: Callback&lt;Size&gt;): void
- 示例
```
```js
var type = 'windowSizeChange';
windowClass.on(type, (data) => {
console.info('Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data));
......@@ -1384,7 +1389,7 @@ off(type: 'windowSizeChange', callback?: Callback&lt;Size &gt;): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'windowSizeChange'时表示监听类型为窗口尺寸变化监听; |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'windowSizeChange'<sup>7+</sup>时表示监听类型为窗口尺寸变化监听; |
| callback | Callback&lt;[Size](#size)&gt; | 否 | 回调返回监听到的信息。 |
- 示例
......@@ -1411,7 +1416,7 @@ on(type: 'systemAvoidAreaChange', callback: Callback&lt;AvoidArea&gt;): void
- 示例
```
```js
var type = 'systemAvoidAreaChange';
windowClass.on(type, (data) => {
console.info('Succeeded in enabling the listener for system avoid area changes. Data: ' + JSON.stringify(data));
......@@ -1452,14 +1457,14 @@ on(type: 'keyboardHeightChange', callback: Callback&lt;number&gt;): void
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyboardHeightChange'时表示监听类型为键盘高度变化监听。 |
| callback | Callback&lt;number&gt; | 是 | 回调返回监听到的信息。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'keyboardHeightChange'时表示监听类型为键盘高度变化监听。 |
| callback | Callbacknumber&gt; | 是 | 回调返回监听到的信息。 |
- 示例
```
```js
var type = 'keyboardHeightChange';
windowClass.on(type, (data) => {
console.info('Succeeded in enabling the listener for keyboard height changes. Data: ' + JSON.stringify(data));
......@@ -1506,7 +1511,7 @@ isSupportWideGamut(callback: AsyncCallback&lt;boolean&gt;): void
- 示例
```
```js
windowClass.isSupportWideGamut((err, data) => {
if (err.code) {
console.error('Failed to check whether the window support WideGamut. Cause:' + JSON.stringify(err));
......@@ -1558,7 +1563,7 @@ setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err, data) => {
if (err.code) {
console.error('Failed to set window colorspace. Cause:' + JSON.stringify(err));
......@@ -1590,7 +1595,7 @@ setColorSpace(colorSpace:ColorSpace): Promise&lt;void&gt;
- 示例
```
```js
let promise = windowClass.isSupportWideGamut(window.ColorSpace.WIDE_GAMUT);
promise.then((data)=> {
console.info('Succeeded in setting window colorspace. Data: ' + JSON.stringify(data))
......@@ -1615,7 +1620,7 @@ getColorSpace(callback: AsyncCallback&lt;ColorSpace&gt;): void
- 示例
```
```js
windowClass.getColorSpace((err, data) => {
if (err.code) {
console.error('Failed to get window color space. Cause:' + JSON.stringify(err));
......@@ -1641,7 +1646,7 @@ getColorSpace(): Promise&lt;ColorSpace&gt;
- 示例
```
```js
let promise = windowClass.getColorSpace();
promise.then((data)=> {
console.info('Succeeded in getting window color space. Cause:' + JSON.stringify(data))
......@@ -1669,7 +1674,7 @@ setBackgroundColor(color: string, callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
var color = '#00ff33';
windowClass.setBackgroundColor(color, (err, data) => {
if (err.code) {
......@@ -1704,7 +1709,7 @@ setBackgroundColor(color: string): Promise&lt;void&gt;
- 示例
```
```js
var color = '#00ff33';
let promise = windowClass.setBackgroundColor(color);
promise.then((data)=> {
......@@ -1733,7 +1738,7 @@ setBrightness(brightness: number, callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
var brightness = 1;
windowClass.setBrightness(brightness, (err, data) => {
if (err.code) {
......@@ -1768,7 +1773,7 @@ setBrightness(brightness: number): Promise&lt;void&gt;
- 示例
```
```js
var brightness = 1;
let promise = windowClass.setBrightness(brightness);
promise.then((data)=> {
......@@ -1797,7 +1802,7 @@ setDimBehind(dimBehindValue: number, callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
windowClass.setDimBehind(0.5, (err, data) => {
if (err.code) {
console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
......@@ -1831,7 +1836,7 @@ setDimBehind(dimBehindValue: number): Promise&lt;void&gt;
- 示例
```
```js
let promise = windowClass.setDimBehind(0.5);
promise.then((data)=> {
console.info('Succeeded in setting the dimness. Data: ' + JSON.stringify(data))
......@@ -1859,7 +1864,7 @@ setFocusable(isFocusable: boolean, callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
var isFocusable= true;
windowClass.setFocusable(isFocusable, (err, data) => {
if (err.code) {
......@@ -1894,7 +1899,7 @@ setFocusable(isFocusable: boolean): Promise&lt;void&gt;
- 示例
```
```js
var isFocusable= true;
let promise = windowClass.setFocusable(isFocusable);
promise.then((data)=> {
......@@ -1923,7 +1928,7 @@ setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback&lt;void&gt;): v
- 示例
```
```js
var isKeepScreenOn = true;
windowClass.setKeepScreenOn(isKeepScreenOn, (err, data) => {
if (err.code) {
......@@ -1958,7 +1963,7 @@ setKeepScreenOn(isKeepScreenOn: boolean): Promise&lt;void&gt;
- 示例
```
```js
var isKeepScreenOn= true;
let promise = windowClass.setKeepScreenOn(isKeepScreenOn);
promise.then((data)=> {
......@@ -1987,7 +1992,7 @@ setOutsideTouchable(touchable: boolean, callback: AsyncCallback&lt;void&gt;): vo
- 示例
```
```js
windowClass.setOutsideTouchable(true, (err, data) => {
if (err.code) {
console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
......@@ -2021,7 +2026,7 @@ setOutsideTouchable(touchable: boolean): Promise&lt;void&gt;
- 示例
```
```js
let promise = windowClass.setOutsideTouchable(true);
promise.then((data)=> {
console.info('Succeeded in setting the area to be touchable. Data: ' + JSON.stringify(data))
......@@ -2049,7 +2054,7 @@ setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback&lt;void&gt;): voi
- 示例
```
```js
var isPrivacyMode = true;
windowClass.setPrivacyMode(isPrivacyMode, (err, data) => {
if (err.code) {
......@@ -2085,7 +2090,7 @@ setPrivacyMode(isPrivacyMode: boolean): Promise&lt;void&gt;
- 示例
```
```js
var isPrivacyMode = true;
let promise = windowClass.setPrivacyMode(isPrivacyMode);
promise.then((data)=> {
......@@ -2114,7 +2119,7 @@ setTouchable(isTouchable: boolean, callback: AsyncCallback&lt;void&gt;): void
- 示例
```
```js
var isTouchable = true;
windowClass.setTouchable(isTouchable, (err, data) => {
if (err.code) {
......@@ -2150,7 +2155,7 @@ setTouchable(isTouchable: boolean): Promise&lt;void&gt;
- 示例
```
```js
var isTouchable = true;
let promise = windowClass.setTouchable(isTouchable);
promise.then((data)=> {
......@@ -2193,7 +2198,7 @@ getMainWindow(): Promise&lt;Window&gt;
- 示例
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2225,7 +2230,7 @@ getMainWindow(callback: AsyncCallback&lt;Window&gt;): void
- 示例
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2249,19 +2254,22 @@ createSubWindow(name: string): Promise&lt;Window&gt;
创建该WindowStage实例下的子窗口,使用Promise方式作为异步方法。
**系统能力**:SystemCapability.WindowManager.WindowManager.Core
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------- |
| name | String | 是 | 子窗口的名字。 |
- 返回值
| 类型 | 说明 |
| -------------------------------- | ------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | 以Promise形式返回结果,返回当前创建的子窗口对象。 |
- 示例
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2294,7 +2302,7 @@ createSubWindow(name: string, callback: AsyncCallback&lt;Window&gt;): void
- 示例
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2319,6 +2327,7 @@ getSubWindow(): Promise&lt;Array&lt;Window&gt;&gt;
获取该WindowStage实例下的所有子窗口,使用Promise方式作为异步方法。
**系统能力**:SystemCapability.WindowManager.WindowManager.Core
- 返回值
| 类型 | 说明 |
......@@ -2327,7 +2336,7 @@ getSubWindow(): Promise&lt;Array&lt;Window&gt;&gt;
- 示例
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2350,6 +2359,7 @@ getSubWindow(callback: AsyncCallback&lt;Array&lt;Window&gt;&gt;): void
获取该WindowStage实例下的所有子窗口,使用callback方式作为异步方法。
**系统能力**:SystemCapability.WindowManager.WindowManager.Core
- 参数
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2358,7 +2368,7 @@ getSubWindow(callback: AsyncCallback&lt;Array&lt;Window&gt;&gt;): void
- 示例
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2389,10 +2399,10 @@ loadContent(path: string, callback: AsyncCallback&lt;void&gt;): void
| -------- | ------------------------- | ---- | -------------------- |
| path | string | 是 | 设置加载页面的路径。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
- 示例
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2406,6 +2416,7 @@ loadContent(path: string, callback: AsyncCallback&lt;void&gt;): void
}
}
```
### on('windowStageEvent')<sup>9+</sup>
on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void
......@@ -2413,6 +2424,7 @@ on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;
开启WindowStage生命周期变化的监听。
**系统能力**:SystemCapability.WindowManager.WindowManager.Core
- 参数
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2422,7 +2434,7 @@ on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;
- 示例
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......@@ -2441,15 +2453,17 @@ off(eventType: 'windowStageEvent', callback?: Callback&lt;WindowStageEventType&g
关闭WindowStage生命周期变化的监听。
**系统能力**:SystemCapability.WindowManager.WindowManager.Core
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 设置监听类型。<br/>-&nbsp;type为'windowStageEvent'时表示监听类型为WindowStage生命周期变化监听。 |
| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | 否 | 回调返回监听到的信息。 |
- 示例
```
```ts
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
......
# WebGL
- [概述](webgl-overview.md)
- [WebGL开发概述](webgl-overview.md)
- [WebGL开发指导](webgl-guidelines.md)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册