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

update docs

Signed-off-by: Nge-yafang <geyafang@huawei.com>
上级 159299f7
......@@ -89,8 +89,9 @@ You can set a USB device as the USB host to connect to other USB devices for dat
]
}
]
*/
```
*/
```
2. Obtain the device operation permissions.
......
......@@ -1864,7 +1864,7 @@ Obtains the area where this window cannot be displayed, for example, the system
| Name| Type| Mandatory| Description|
| ---- |----------------------------------| -- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype7) | Yes| Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch. **TYPE_SYSTEM_GESTURE** indicates the gesture area. **TYPE_KEYBOARD** indicates the soft keyboard area.|
| type | [AvoidAreaType](#avoidareatype7) | Yes| Type of the area. |
**Return value**
......@@ -2500,7 +2500,7 @@ Disables listening for window size changes.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | -------------------------------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'windowSizeChange'**, indicating the window size change event.|
| callback | Callback&lt;[Size](#size)&gt; | No | Callback used to return the window size. |
| callback | Callback&lt;[Size](#size7)&gt; | No | Callback used to return the window size. |
**Example**
......@@ -3006,7 +3006,7 @@ Sets a color space for this window. This API uses an asynchronous callback to re
| Name| Type| Mandatory| Description|
| ---------- | ------------------------- | -- | ----------- |
| colorSpace | [ColorSpace](#colorspace) | Yes| Color space to set.|
| colorSpace | [ColorSpace](#colorspace8) | Yes| Color space to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. |
**Error codes**
......@@ -3045,7 +3045,7 @@ Sets a color space for this window. This API uses a promise to return the result
| Name| Type| Mandatory| Description|
| ---------- | ------------------------- | -- | ------------- |
| colorSpace | [ColorSpace](#colorspace) | Yes| Color space to set.|
| colorSpace | [ColorSpace](#colorspace8) | Yes| Color space to set.|
**Return value**
......@@ -3088,7 +3088,7 @@ Obtains the color space of this window.
| Type| Description|
| ------------------------- | ------------- |
| [ColorSpace](#colorspace) | Color space obtained.|
| [ColorSpace](#colorspace8) | Color space obtained.|
**Error codes**
......@@ -4631,7 +4631,7 @@ Obtains the area where this window cannot be displayed, for example, the system
| Name | Type | Mandatory | Description |
| -------- | --------------------------------------------- | --------- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype7) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch. **TYPE_SYSTEM_GESTURE** indicates the gesture area. **TYPE_KEYBOARD** indicates the soft keyboard area. |
| type | [AvoidAreaType](#avoidareatype7) | Yes | Type of the area. |
| callback | AsyncCallback&lt;[AvoidArea](#avoidarea7)&gt; | Yes | Callback used to return the area. |
**Example**
......@@ -4664,7 +4664,7 @@ Obtains the area where this window cannot be displayed, for example, the system
| Name | Type | Mandatory | Description |
| ---- | -------------------------------- | --------- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype7) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch. **TYPE_SYSTEM_GESTURE** indicates the gesture area. **TYPE_KEYBOARD** indicates the soft keyboard area. |
| type | [AvoidAreaType](#avoidareatype7) | Yes | Type of the area. |
**Return value**
......@@ -5239,7 +5239,7 @@ Sets a color space for this window. This API uses an asynchronous callback to re
| Name | Type | Mandatory | Description |
| ---------- | ------------------------- | --------- | ----------------------------------- |
| colorSpace | [ColorSpace](#colorspace) | Yes | Color space to set. |
| colorSpace | [ColorSpace](#colorspace8) | Yes | Color space to set. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -5271,7 +5271,7 @@ Sets a color space for this window. This API uses a promise to return the result
| Name | Type | Mandatory | Description |
| ---------- | ------------------------- | --------- | ------------------- |
| colorSpace | [ColorSpace](#colorspace) | Yes | Color space to set. |
| colorSpace | [ColorSpace](#colorspace8) | Yes | Color space to set. |
**Return value**
......@@ -5307,7 +5307,7 @@ Obtains the color space of this window. This API uses an asynchronous callback t
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------------- | --------- | ------------------------------------------------------------ |
| callback | AsyncCallback&lt;[ColorSpace](#colorspace)&gt; | Yes | Callback used to return the result. When the color space is obtained successfully, **err** is **undefined**, and **data** is the current color space. |
| callback | AsyncCallback&lt;[ColorSpace](#colorspace8)&gt; | Yes | Callback used to return the result. When the color space is obtained successfully, **err** is **undefined**, and **data** is the current color space. |
**Example**
......@@ -5338,7 +5338,7 @@ Obtains the color space of this window. This API uses a promise to return the re
| Type | Description |
| ---------------------------------------- | ----------------------------------------------- |
| Promise&lt;[ColorSpace](#colorspace)&gt; | Promise used to return the current color space. |
| Promise&lt;[ColorSpace](#colorspace8)&gt; | Promise used to return the current color space. |
**Example**
......
......@@ -47,30 +47,30 @@ You can create a subwindow, such as a dialog box, and set its properties.
- Call **window.createWindow** to create a subwindow.
- Call **window.findWindow** to find an available subwindow.
```js
import window from '@ohos.window';
```js
import window from '@ohos.window';
let windowClass = null;
// Method 1: Create a subwindow.
let config = {name: "subWindow", windowType: window.WindowType.TYPE_APP, ctx: this.context};
window.createWindow(config, (err, data) => {
if (err.code) {
console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in creating subWindow. Data: ' + JSON.stringify(data));
windowClass = data;
});
// Method 2: Find a subwindow.
window.findWindow("subWindow", (err, data) => {
if (err.code) {
console.error('Failed to find the subWindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in finding subWindow. Data: ' + JSON.stringify(data));
windowClass = data;
});
```
let windowClass = null;
// Method 1: Create a subwindow.
let config = {name: "subWindow", windowType: window.WindowType.TYPE_APP, ctx: this.context};
window.createWindow(config, (err, data) => {
if (err.code) {
console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in creating subWindow. Data: ' + JSON.stringify(data));
windowClass = data;
});
// Method 2: Find a subwindow.
window.findWindow("subWindow", (err, data) => {
if (err.code) {
console.error('Failed to find the subWindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in finding subWindow. Data: ' + JSON.stringify(data));
windowClass = data;
});
```
2. Set the properties of the subwindow.
......
......@@ -1864,7 +1864,7 @@ getWindowAvoidArea(type: AvoidAreaType): AvoidArea
| 参数名 | 类型 | 必填 | 说明 |
| ---- |----------------------------------| -- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype7) | 是 | 表示规避区类型。type为TYPE_SYSTEM,表示系统默认区域。type为TYPE_CUTOUT,表示刘海屏区域。type为TYPE_SYSTEM_GESTURE,表示手势区域。type为TYPE_KEYBOARD,表示软键盘区域。 |
| type | [AvoidAreaType](#avoidareatype7) | 是 | 表示规避区类型。 |
**返回值:**
......@@ -2500,7 +2500,7 @@ off(type: 'windowSizeChange', callback?: Callback&lt;Size&gt;): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | -------------------------------------------------------- |
| type | string | 是 | 监听事件,固定为'windowSizeChange',即窗口尺寸变化事件。 |
| callback | Callback&lt;[Size](#size)&gt; | 否 | 回调函数。返回当前的窗口尺寸。 |
| callback | Callback&lt;[Size](#size7)&gt; | 否 | 回调函数。返回当前的窗口尺寸。 |
**示例:**
......@@ -3006,7 +3006,7 @@ setWindowColorSpace(colorSpace:ColorSpace, callback: AsyncCallback&lt;void&gt;):
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | -- | ----------- |
| colorSpace | [ColorSpace](#colorspace) | 是 | 设置色域模式。 |
| colorSpace | [ColorSpace](#colorspace8) | 是 | 设置色域模式。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**错误码:**
......@@ -3045,7 +3045,7 @@ setWindowColorSpace(colorSpace:ColorSpace): Promise&lt;void&gt;
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | -- | ------------- |
| colorSpace | [ColorSpace](#colorspace) | 是 | 设置色域模式。 |
| colorSpace | [ColorSpace](#colorspace8) | 是 | 设置色域模式。 |
**返回值:**
......@@ -3088,7 +3088,7 @@ getWindowColorSpace(): ColorSpace
| 类型 | 说明 |
| ------------------------- | ------------- |
| [ColorSpace](#colorspace) | 当前色域模式。 |
| [ColorSpace](#colorspace8) | 当前色域模式。 |
**错误码:**
......@@ -4615,7 +4615,7 @@ getAvoidArea(type: [AvoidAreaType](#avoidareatype7), callback: AsyncCallback&lt;
| 参数名 | 类型 | 必填 | 说明 |
| -------- |-----------------------------------------------| ---- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype7) | 是 | 表示规避区类型。type为TYPE_SYSTEM,表示系统默认区域。type为TYPE_CUTOUT,表示刘海屏区域。type为TYPE_SYSTEM_GESTURE,表示手势区域。type为TYPE_KEYBOARD,表示软键盘区域。 |
| type | [AvoidAreaType](#avoidareatype7) | 是 | 表示规避区类型。|
| callback | AsyncCallback&lt;[AvoidArea](#avoidarea7)&gt; | 是 | 回调函数。返回窗口内容规避区域。 |
**示例:**
......@@ -4647,7 +4647,7 @@ getAvoidArea(type: [AvoidAreaType](#avoidareatype7)): Promise&lt;[AvoidArea](#av
| 参数名 | 类型 | 必填 | 说明 |
| ------ |----------------------------------| ---- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype7) | 是 | 表示规避区类型。type为TYPE_SYSTEM,表示系统默认区域。type为TYPE_CUTOUT,表示刘海屏区域。type为TYPE_SYSTEM_GESTURE,表示手势区域。type为TYPE_KEYBOARD,表示软键盘区域。 |
| type | [AvoidAreaType](#avoidareatype7) | 是 | 表示规避区类型。 |
**返回值:**
......@@ -5205,7 +5205,7 @@ setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback&lt;void&gt;): void
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------ |
| colorSpace | [ColorSpace](#colorspace) | 是 | 设置色域模式。 |
| colorSpace | [ColorSpace](#colorspace8) | 是 | 设置色域模式。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
......@@ -5236,7 +5236,7 @@ setColorSpace(colorSpace:ColorSpace): Promise&lt;void&gt;
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | -------------- |
| colorSpace | [ColorSpace](#colorspace) | 是 | 设置色域模式。 |
| colorSpace | [ColorSpace](#colorspace8) | 是 | 设置色域模式。 |
**返回值:**
......@@ -5271,7 +5271,7 @@ getColorSpace(callback: AsyncCallback&lt;ColorSpace&gt;): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------- | ---- | ---------------------------------------------------------- |
| callback | AsyncCallback&lt;[ColorSpace](#colorspace)&gt; | 是 | 回调函数。当获取成功,err为undefined,data为当前色域模式。 |
| callback | AsyncCallback&lt;[ColorSpace](#colorspace8)&gt; | 是 | 回调函数。当获取成功,err为undefined,data为当前色域模式。 |
**示例:**
......@@ -5301,7 +5301,7 @@ getColorSpace(): Promise&lt;ColorSpace&gt;
| 类型 | 说明 |
| ---------------------------------------- | ------------------------------- |
| Promise&lt;[ColorSpace](#colorspace)&gt; | Promise对象。返回当前色域模式。 |
| Promise&lt;[ColorSpace](#colorspace8)&gt; | Promise对象。返回当前色域模式。 |
**示例:**
......
......@@ -49,30 +49,30 @@
- 可以通过`window.createWindow`接口创建子窗口。
- 也可以通过`window.findWindow`接口来查找已经创建的窗口从而得到子窗口。
```js
import window from '@ohos.window';
```js
import window from '@ohos.window';
let windowClass = null;
// 方式一:创建子窗口。
let config = {name: "subWindow", windowType: window.WindowType.TYPE_APP};
window.createWindow(config, (err, data) => {
if (err.code) {
console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in creating subWindow. Data: ' + JSON.stringify(data));
windowClass = data;
});
// 方式二:查找得到子窗口。
window.findWindow("subWindow", (err, data) => {
if (err.code) {
console.error('Failed to find the subWindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in finding subWindow. Data: ' + JSON.stringify(data));
windowClass = data;
});
```
let windowClass = null;
// 方式一:创建子窗口。
let config = {name: "subWindow", windowType: window.WindowType.TYPE_APP};
window.createWindow(config, (err, data) => {
if (err.code) {
console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in creating subWindow. Data: ' + JSON.stringify(data));
windowClass = data;
});
// 方式二:查找得到子窗口。
window.findWindow("subWindow", (err, data) => {
if (err.code) {
console.error('Failed to find the subWindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in finding subWindow. Data: ' + JSON.stringify(data));
windowClass = data;
});
```
2. 设置子窗口属性。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册