提交 30eea4e0 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 f4ffb34e
# Display
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
......@@ -56,26 +57,27 @@ getDefaultDisplay(callback: AsyncCallback&lt;Display&gt;): void
Obtains the default display object.
**System capabilities**: SystemCapability.WindowManager.WindowManager.Core
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[Display](#display)&gt; | Yes| Callback used to return the default display object.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[Display](#display)&gt; | Yes| Callback used to return the default display object.|
- Example
**Example**
```js
var displayClass = null;
display.getDefaultDisplay((err, data) => {
```js
var displayClass = null;
display.getDefaultDisplay((err, data) => {
if (err.code) {
console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in obtaining the default display object. Data:' + JSON.stringify(data));
displayClass = data;
});
```
});
```
## display.getDefaultDisplay
......@@ -83,24 +85,24 @@ getDefaultDisplay(): Promise&lt;Display&gt;
Obtains the default display object.
**System capabilities**: SystemCapability.WindowManager.WindowManager.Core
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| ---------------------------------- | ---------------------------------------------- |
| Promise&lt;[Display](#display)&gt; | Promise used to return the default display object.|
| Type | Description |
| ---------------------------------- | ---------------------------------------------- |
| Promise&lt;[Display](#display)&gt; | Promise used to return the default display object.|
- Example
**Example**
```js
let promise = display.getDefaultDisplay();
promise.then(() => {
```js
let promise = display.getDefaultDisplay();
promise.then(() => {
console.log('getDefaultDisplay success');
}).catch((err) => {
}).catch((err) => {
console.log('getDefaultDisplay fail: ' + JSON.stringify(err));
});
```
});
```
## display.getAllDisplay
......@@ -108,25 +110,25 @@ getAllDisplay(callback: AsyncCallback&lt;Array&lt;Display&gt;&gt;): void
Obtains all the display objects.
**System capabilities**: SystemCapability.WindowManager.WindowManager.Core
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------- | ---- | ------------------------------- |
| callback | AsyncCallback&lt;Array&lt;[Display](#display)&gt;&gt; | Yes | Callback used to return all the display objects.|
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------- | ---- | ------------------------------- |
| callback | AsyncCallback&lt;Array&lt;[Display](#display)&gt;&gt; | Yes | Callback used to return all the display objects.|
- Example
**Example**
```js
display.getAllDisplay((err, data) => {
```js
display.getAllDisplay((err, data) => {
if (err.code) {
console.error('Failed to obtain all the display objects. Code: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in obtaining all the display objects. Data: ' + JSON.stringify(data))
});
```
});
```
## display.getAllDisplay
......@@ -134,24 +136,24 @@ getAllDisplay(): Promise&lt;Array&lt;Display&gt;&gt;
Obtains all the display objects.
**System capabilities**: SystemCapability.WindowManager.WindowManager.Core
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| ----------------------------------------------- | ------------------------------------------------------- |
| Promise&lt;Array&lt;[Display](#display)&gt;&gt; | Promise used to return an array containing all the display objects.|
| Type | Description |
| ----------------------------------------------- | ------------------------------------------------------- |
| Promise&lt;Array&lt;[Display](#display)&gt;&gt; | Promise used to return an array containing all the display objects.|
- Example
**Example**
```js
let promise = display.getAllDisplay();
promise.then(() => {
```js
let promise = display.getAllDisplay();
promise.then(() => {
console.log('getAllDisplay success');
}).catch((err) => {
}).catch((err) => {
console.log('getAllDisplay fail: ' + JSON.stringify(err));
});
```
});
```
## display.on('add'|'remove'|'change')
......@@ -159,23 +161,24 @@ on(type: 'add'|'remove'|'change', callback: Callback&lt;number&gt;): void
Enables listening.
**System capabilities**: SystemCapability.WindowManager.WindowManager.Core
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Listening type. The available values are as follows:<br>-&nbsp;**add**: listening for whether a display is added<br>-&nbsp;**remove**: listening for whether a display is removed<br>-&nbsp;**change**: listening for whether a display is changed|
| callback | Callback&lt;number&gt; | Yes| Callback used to return the ID of the display.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Listening type. The available values are as follows:<br>-&nbsp;**add**: listening for whether a display is added<br>-&nbsp;**remove**: listening for whether a display is removed<br>-&nbsp;**change**: listening for whether a display is changed|
| callback | Callback&lt;number&gt; | Yes| Callback used to return the ID of the display.|
- Example
**Example**
```js
var type = "add";
var callback = (data) => {
```js
var type = "add";
var callback = (data) => {
console.info('Listening enabled. Data: ' + JSON.stringify(data))
}
display.on(type, callback);
```
}
display.on(type, callback);
```
## display.off('add'|'remove'|'change')
......@@ -184,17 +187,18 @@ off(type: 'add'|'remove'|'change', callback?: Callback&lt;number&gt;): void
Disables listening.
**System capabilities**: SystemCapability.WindowManager.WindowManager.Core
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Listening type. The available values are as follows:<br>-&nbsp;**add**: listening for whether a display is added<br>-&nbsp;**remove**: listening for whether a display is removed<br>-&nbsp;**change**: listening for whether a display is changed|
| callback | Callback&lt;number&gt; | No| Callback used to return the ID of the display.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Listening type. The available values are as follows:<br>-&nbsp;**add**: listening for whether a display is added<br>-&nbsp;**remove**: listening for whether a display is removed<br>-&nbsp;**change**: listening for whether a display is changed|
| callback | Callback&lt;number&gt; | No| Callback used to return the ID of the display.|
- Example
**Example**
```js
var type = "remove";
display.off(type);
```
```js
var type = "remove";
display.off(type);
```
\ No newline at end of file
# Screenshot
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
......@@ -54,21 +55,21 @@ save(options?: ScreenshotOptions, callback: AsyncCallback&lt;image.PixelMap&gt;)
Takes a screenshot and saves it as a **PixelMap** object. This method uses a callback to return the result.
**System capabilities**: SystemCapability.WindowManager.WindowManager.Core
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Required permissions**: ohos.permission.CAPTURE_SCREEN
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [ScreenshotOptions](#screenshotoptions) | No | Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|
| callback | AsyncCallback&lt;image.PixelMap&gt; | Yes | Callback used to return a **PixelMap** object. |
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [ScreenshotOptions](#screenshotoptions) | No | Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|
| callback | AsyncCallback&lt;image.PixelMap&gt; | Yes | Callback used to return a **PixelMap** object. |
- Example
**Example**
```js
var ScreenshotOptions = {
```js
var ScreenshotOptions = {
"screenRect": {
"left": 200,
"top": 100,
......@@ -78,15 +79,15 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal
"width": 300,
"height": 300},
"rotation": 0
};
screenshot.save(ScreenshotOptions, (err, data) => {
};
screenshot.save(ScreenshotOptions, (err, data) => {
if (err) {
console.error('Failed to save the screenshot. Error: ' + JSON.stringify(err));
return;
}
console.info('Screenshot saved. Data: ' + JSON.stringify(data));
});
```
});
```
## screenshot.save
......@@ -94,26 +95,26 @@ save(options?: ScreenshotOptions): Promise&lt;image.PixelMap&gt;
Takes a screenshot and saves it as a **PixelMap** object. This method uses a promise to return the result.
**System capabilities**: SystemCapability.WindowManager.WindowManager.Core
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Required permissions**: ohos.permission.CAPTURE_SCREEN
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [ScreenshotOptions](#screenshotoptions) | No | Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|
| Name | Type | Mandatory| Description |
| ------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [ScreenshotOptions](#screenshotoptions) | No | Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|
- Return value
**Return value**
| Type | Description |
| ----------------------------- | ----------------------------------------------- |
| Promise&lt;image.PixelMap&gt; | Promise used to return an **image.PixelMap** object.|
| Type | Description |
| ----------------------------- | ----------------------------------------------- |
| Promise&lt;image.PixelMap&gt; | Promise used to return an **image.PixelMap** object.|
- Example
**Example**
```js
var ScreenshotOptions = {
```js
var ScreenshotOptions = {
"screenRect": {
"left": 200,
"top": 100,
......@@ -123,11 +124,11 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro
"width": 300,
"height": 300},
"rotation": 0
};
let promise = screenshot.save(ScreenshotOptions);
promise.then(() => {
};
let promise = screenshot.save(ScreenshotOptions);
promise.then(() => {
console.log('screenshot save success');
}).catch((err) => {
}).catch((err) => {
console.log('screenshot save fail: ' + JSON.stringify(err));
});
```
});
```
\ No newline at end of file
# USB
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
......@@ -17,18 +18,20 @@ Obtains the USB device list.
**System capability**: SystemCapability.USB.USBManager
- Return value
| Type| Description|
| -------- | -------- |
| Array&lt;Readonly&lt;[USBDevice](#usbdevice)&gt;&gt; | Device information list.|
- Example
```
let devicesList = usb.getDevices();
console.log(`devicesList = ${JSON.stringify(devicesList)}`);
// devicesList is a list of USB devices.
// A simple example of devicesList is provided as follows:
[
**Return value**
| Type| Description|
| -------- | -------- |
| Array&lt;Readonly&lt;[USBDevice](#usbdevice)&gt;&gt; | Device information list.|
**Example**
```
let devicesList = usb.getDevices();
console.log(`devicesList = ${JSON.stringify(devicesList)}`);
// devicesList is a list of USB devices.
// A simple example of devicesList is provided as follows:
[
{
name: "1-1",
serial: "",
......@@ -75,8 +78,8 @@ Obtains the USB device list.
},
],
},
]
```
]
```
## usb.connectDevice
......@@ -89,21 +92,24 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | [USBDevice](#usbdevice) | Yes| USB device information.|
**Parameters**
- Return value
| Type| Description|
| -------- | -------- |
| Readonly&lt;[USBDevicePipe](#usbdevicepipe)&gt; | USB device pipe for data transfer.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | [USBDevice](#usbdevice) | Yes| USB device information.|
- Example
```
let devicepipe= usb.connectDevice(device);
console.log(`devicepipe = ${JSON.stringify(devicepipe)}`);
```
**Return value**
| Type| Description|
| -------- | -------- |
| Readonly&lt;[USBDevicePipe](#usbdevicepipe)&gt; | USB device pipe for data transfer.|
**Example**
```
let devicepipe= usb.connectDevice(device);
console.log(`devicepipe = ${JSON.stringify(devicepipe)}`);
```
## usb.hasRight
......@@ -114,22 +120,25 @@ Checks whether the application has the permission to access the device.
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Return value**
- Return value
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
- Example
```
let divicesName="1-1";
let bool = usb.hasRight(divicesName);
console.log(bool);
```
**Example**
```
let divicesName="1-1";
let bool = usb.hasRight(divicesName);
console.log(bool);
```
## usb.requestRight
......@@ -140,23 +149,26 @@ Requests the temporary permission for the application to access the USB device.
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Returns **true** if the temporary device access permissions are granted; returns **false** otherwise.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Returns **true** if the temporary device access permissions are granted; returns **false** otherwise.|
**Example**
- Example
```
let divicesName="1-1";
usb.requestRight(divicesName).then((ret) => {
```
let divicesName="1-1";
usb.requestRight(divicesName).then((ret) => {
console.log(`requestRight = ${JSON.stringify(ret)}`);
});
```
});
```
## usb.claimInterface
......@@ -169,23 +181,26 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
- Return value
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
**Return value**
- Example
```
let ret = usb.claimInterface(devicepipe, interfaces);
console.log(`claimInterface = ${ret}`);
```
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
**Example**
```
let ret = usb.claimInterface(devicepipe, interfaces);
console.log(`claimInterface = ${ret}`);
```
## usb.releaseInterface
......@@ -198,22 +213,25 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
**Return value**
- Return value
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
- Example
```
let ret = usb.releaseInterface(devicepipe, interfaces);
console.log(`releaseInterface = ${ret}`);
```
**Example**
```
let ret = usb.releaseInterface(devicepipe, interfaces);
console.log(`releaseInterface = ${ret}`);
```
## usb.setConfiguration
......@@ -226,22 +244,25 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
**Parameters**
- Return value
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
- Example
```
let ret = usb.setConfiguration(devicepipe, config);
console.log(`setConfiguration = ${ret}`);
```
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
**Example**
```
let ret = usb.setConfiguration(devicepipe, config);
console.log(`setConfiguration = ${ret}`);
```
## usb.setInterface
......@@ -254,22 +275,25 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface to set.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface to set.|
- Return value
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
**Return value**
- Example
```
let ret = usb.setInterface(devicepipe, interfaces);
console.log(`setInterface = ${ret}`);
```
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
**Example**
```
let ret = usb.setInterface(devicepipe, interfaces);
console.log(`setInterface = ${ret}`);
```
## usb.getRawDescriptor
......@@ -282,20 +306,23 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
- Return value
| Type| Description|
| -------- | -------- |
| Uint8Array | Raw descriptor data.|
**Return value**
- Example
```
let ret = usb.getRawDescriptor(devicepipe);
```
| Type| Description|
| -------- | -------- |
| Uint8Array | Raw descriptor data.|
**Example**
```
let ret = usb.getRawDescriptor(devicepipe);
```
## usb.getFileDescriptor
......@@ -308,20 +335,23 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Parameters**
- Return value
| Type| Description|
| -------- | -------- |
| number | File descriptor of the USB device.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
- Example
```
let ret = usb.getFileDescriptor(devicepipe);
```
**Return value**
| Type| Description|
| -------- | -------- |
| number | File descriptor of the USB device.|
**Example**
```
let ret = usb.getFileDescriptor(devicepipe);
```
## usb.controlTransfer
......@@ -334,24 +364,27 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
- Example
```
usb.controlTransfer(devicepipe, USBControlParams).then((ret) => {
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
**Example**
```
usb.controlTransfer(devicepipe, USBControlParams).then((ret) => {
console.log(`controlTransfer = ${JSON.stringify(ret)}`);
})
```
})
```
## usb.bulkTransfer
......@@ -364,28 +397,31 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
- Example
```
// Call usb.getDevices to obtain a data set. Then, obtain a USB device and its access permission.
// Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device.
// Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer.
usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => {
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
**Example**
```
// Call usb.getDevices to obtain a data set. Then, obtain a USB device and its access permission.
// Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device.
// Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer.
usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => {
console.log(`bulkTransfer = ${JSON.stringify(ret)}`);
});
```
});
```
## usb.closePipe
......@@ -398,21 +434,24 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
- Return value
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
- Example
```
let ret = usb.closePipe(devicepipe);
console.log(`closePipe = ${ret}`);
```
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
**Example**
```
let ret = usb.closePipe(devicepipe);
console.log(`closePipe = ${ret}`);
```
## USBEndpoint
......
# webgl
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -22,7 +23,7 @@ Create a **<canvas\>** component in the HML file. The following is an example:
Obtain the **<canvas\>** component instance in the JS file. The following is an example:
```
```js
// Obtain the <canvas> component instance.
const el = this.$refs.canvas1;
// Obtain the WebGL context from the <canvas> component instance.
......@@ -87,7 +88,7 @@ gl.clearColor(0.0, 0.0, 0.0, 1.0);
WebGLContextAttributes
| Name| Type| Mandatory|
| Name| Type| Mandatory|
| -------- | -------- | -------- |
| alpha | boolean | No|
| depth | boolean | No|
......@@ -104,7 +105,7 @@ WebGLContextAttributes
WebGLActiveInfo
| Name| Type| Mandatory|
| Name| Type| Mandatory|
| -------- | -------- | -------- |
| size | GLint | Yes|
| type | GLenum | Yes|
......@@ -115,7 +116,7 @@ WebGLActiveInfo
WebGLShaderPrecisionFormat
| Name| Type| Mandatory|
| Name| Type| Mandatory|
| -------- | -------- | -------- |
| rangeMin | GLint | Yes|
| rangeMax | GLint | Yes|
......@@ -129,7 +130,7 @@ WebGLRenderingContextBase
### Attributes
| Name| Type| Mandatory|
| Name| Type| Mandatory|
| -------- | -------- | -------- |
| DEPTH_BUFFER_BIT | GLenum | Yes|
| STENCIL_BUFFER_BIT | GLenum | Yes|
......@@ -432,7 +433,7 @@ WebGLRenderingContextBase
### Methods
| Method| Return Value Type|
| Method| Return Value Type|
| -------- | -------- |
| getContextAttributes() | WebGLContextAttributes&nbsp;\|&nbsp;null |
| isContextLost() | boolean |
......@@ -558,7 +559,7 @@ WebGLRenderingContextBase
WebGLRenderingContextOverloads
| Method| Return Value Type|
| Method| Return Value Type|
| -------- | -------- |
| bufferData(target:&nbsp;GLenum,&nbsp;size:&nbsp;GLsizeiptr,&nbsp;usage:&nbsp;GLenum) | void |
| bufferData(target:&nbsp;GLenum,&nbsp;data:&nbsp;BufferSource&nbsp;\|&nbsp;null,&nbsp;usage:&nbsp;GLenum) | void |
......
# webgl2
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -22,7 +23,7 @@ Create a **<canvas\>** component in the HML file. The following is an example:
Obtain the **<canvas\>** component instance in the JS file. The following is an example:
```
```js
// Obtain the <canvas> component instance.
const el = this.$refs.canvas1;
// Obtain the WebGL context from the <canvas> component instance.
......@@ -70,7 +71,7 @@ WebGL2RenderingContextBase
### Attributes
| Name| Type| Mandatory|
| Name| Type| Mandatory|
| -------- | -------- | -------- |
| READ_BUFFER | GLenum | Yes|
| UNPACK_ROW_LENGTH | GLenum | Yes|
......@@ -338,7 +339,7 @@ WebGL2RenderingContextBase
### Methods
| Method| Return Value Type|
| Method| Return Value Type|
| -------- | -------- |
| copyBufferSubData(readTarget:&nbsp;GLenum,&nbsp;writeTarget:&nbsp;GLenum,&nbsp;readOffset:&nbsp;GLintptr,&nbsp;writeOffset:&nbsp;GLintptr,&nbsp;size:&nbsp;GLsizeiptr) | void |
| getBufferSubData(target:&nbsp;GLenum,&nbsp;srcByteOffset:&nbsp;GLintptr,&nbsp;dstBuffer:&nbsp;ArrayBufferView,&nbsp;dstOffset?:&nbsp;GLuint,&nbsp;length?:&nbsp;GLuint) | void |
......@@ -441,7 +442,7 @@ WebGL2RenderingContextBase
WebGL2RenderingContextOverloads
| Method| Return Value Type|
| Method| Return Value Type|
| -------- | -------- |
| bufferData(target:&nbsp;GLenum,&nbsp;size:&nbsp;GLsizeiptr,&nbsp;usage:&nbsp;GLenum) | void |
| bufferData(target:&nbsp;GLenum,&nbsp;srcData:&nbsp;BufferSource&nbsp;\|&nbsp;null,&nbsp;usage:&nbsp;GLenum) | void |
......
# Window
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
The **Window** module provides basic capabilities for managing windows, including creating and destroying windows and setting serial port attributes.
> **NOTE**<br/>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
......@@ -95,7 +97,7 @@ This is a system API and cannot be called by third-party applications.
## Rect<sup>7+</sup>
Describes a rectangle.
Rectangular area of the window.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
......@@ -172,7 +174,7 @@ This API is discarded since API version 8. You are advised to use [window.create
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | -------------------------- |
......@@ -180,7 +182,7 @@ This API is discarded since API version 8. You are advised to use [window.create
| type | [WindowType](#windowtype) | Yes | Window type. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the subwindow created.|
- Example
**Example**
```js
var windowClass = null;
......@@ -205,20 +207,20 @@ This API is discarded since API version 8. You are advised to use [window.create
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- | ---------- |
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type.|
- Return value
**Return value**
| Type | Description |
| -------------------------------- | ------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow created.|
- Example
**Example**
```js
var windowClass = null;
......@@ -237,20 +239,20 @@ create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback&lt;Wi
Creates a subwindow when the context is [Context](js-apis-Context.md). This API uses an asynchronous callback to return the result.
Creates a system window when the context is [ServiceExtAbilityContext](js-apis-serviceExtAbilityContext.md), starting from API version 9. This API uses an asynchronous callback to return the result.
Creates a system window when the context is [ServiceExtensionContext](js-apis-service-extension-context.md), starting from API version 9. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| ctx | Context | Yes | Current application context.<br>For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).<br>For the definition of **Context** of API version 9, see [Context](js-apis-serviceExtAbilityContext.md).|
| ctx | Context | Yes | Current application context.<br>For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).<br>For the definition of **Context** of API version 9, see [Context](js-apis-service-extension-context.md).|
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the window created. |
- Example
**Example**
```js
var windowClass = null;
......@@ -271,25 +273,25 @@ create(ctx: Context, id: string, type: WindowType): Promise&lt;Window&gt;
Creates a subwindow when the context is [Context](js-apis-Context.md). This API uses a promise to return the result.
Creates a system window when the context is [ServiceExtAbilityContext](js-apis-serviceExtAbilityContext.md), starting from API version 9. This API uses a promise to return the result.
Creates a system window when the context is [ServiceExtensionContext](js-apis-service-extension-context.md), starting from API version 9. This API uses a promise to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- | ------------------------------------------------------------ |
| ctx | Context | Yes | Current application context.<br>For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).<br>For the definition of **Context** of API version 9, see [Context](js-apis-serviceExtAbilityContext.md).|
| ctx | Context | Yes | Current application context.<br>For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).<br>For the definition of **Context** of API version 9, see [Context](js-apis-service-extension-context.md).|
| id | string | Yes | Window ID. |
| type | [WindowType](#windowtype) | Yes | Window type. |
- Return value
**Return value**
| Type | Description |
| -------------------------------- | ----------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the window created.|
- Example
**Example**
```js
var windowClass = null;
......@@ -310,14 +312,14 @@ Finds a window based on the ID. This API uses an asynchronous callback to return
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ---------------------------- |
| id | string | Yes | Window ID. |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the window found.|
- Example
**Example**
```js
var windowClass = null;
......@@ -339,19 +341,19 @@ Finds a window based on the ID. This API uses a promise to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| id | string | Yes | Window ID.|
- Return value
**Return value**
| Type | Description |
| -------------------------------- | ----------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the window found.|
- Example
**Example**
```js
var windowClass = null;
......@@ -370,15 +372,17 @@ getTopWindow(callback: AsyncCallback&lt;Window&gt;): void
Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
This API is discarded since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the top window obtained.|
- Example
**Example**
```js
var windowClass = null;
......@@ -398,15 +402,17 @@ getTopWindow(): Promise&lt;Window&gt;
Obtains the top window of the current application. This API uses a promise to return the result.
This API is discarded since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| -------------------------------- | --------------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the top window obtained.|
- Example
**Example**
```js
var windowClass = null;
......@@ -427,14 +433,14 @@ Obtains the top window of the current application. This API uses an asynchronous
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| ctx | Context | Yes | Current application context.<br>For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).<br>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
**Example**
```js
var windowClass = null;
......@@ -456,19 +462,19 @@ Obtains the top window of the current application. This API uses a promise to re
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| ctx | Context | Yes | Current application context.<br>For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).<br>For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md).|
- Return value
**Return value**
| Type | Description |
| -------------------------------- | --------------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the top window obtained.|
- Example
**Example**
```js
var windowClass = null;
......@@ -491,14 +497,14 @@ This is a system API and cannot be called by third-party applications.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of event to listen for. The value is fixed at **systemBarTintChange**, indicating the property change event of the status bar and navigation bar.|
| callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | Yes | Callback used to return the information. |
- Example
**Example**
```js
var type = 'systemBarTintChange';
......@@ -517,14 +523,14 @@ This is a system API and cannot be called by third-party applications.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of event to listen for. The value is fixed at **systemBarTintChange**, indicating the property change event of the status bar and navigation bar.|
| callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | No | Callback used to return the information. |
- Example
**Example**
```js
var type = 'systemBarTintChange';
......@@ -545,13 +551,13 @@ This is a system API and cannot be called by third-party applications.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result.|
- Example
**Example**
```js
windowClass.hide((err, data) => {
......@@ -573,13 +579,13 @@ This is a system API and cannot be called by third-party applications.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
let promise = windowClass.hide();
......@@ -598,13 +604,13 @@ Shows this window. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result.|
- Example
**Example**
```js
windowClass.show((err, data) => {
......@@ -624,13 +630,13 @@ Shows this window. This API uses a promise to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
let promise = windowClass.show();
......@@ -649,13 +655,13 @@ Destroys this window. This API uses an asynchronous callback to return the resul
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result.|
- Example
**Example**
```js
windowClass.destroy((err, data) => {
......@@ -675,13 +681,13 @@ Destroys this window. This API uses a promise to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
let promise = windowClass.destroy();
......@@ -700,7 +706,7 @@ Moves the position of this window. This API uses an asynchronous callback to ret
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | --------------------------------------- |
......@@ -708,7 +714,7 @@ Moves the position of this window. This API uses an asynchronous callback to ret
| 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
**Example**
```js
windowClass.moveTo(300, 300, (err, data)=>{
......@@ -729,20 +735,20 @@ Moves the position of this window. This API uses a promise to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
let promise = windowClass.moveTo(300, 300);
......@@ -761,7 +767,7 @@ Changes the size of this window. This API uses an asynchronous callback to retur
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------------- |
......@@ -769,7 +775,7 @@ Changes the size of this window. This API uses an asynchronous callback to retur
| height | number | Yes | New height of the window.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example
**Example**
```js
windowClass.resetSize(500, 1000, (err, data) => {
......@@ -789,20 +795,20 @@ Changes the size of this window. This API uses a promise to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- |
| width | number | Yes | New width of the window.|
| height | number | Yes | New height of the window.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
let promise = windowClass.resetSize(500, 1000);
......@@ -823,14 +829,14 @@ This is a system API and cannot be called by third-party applications.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| type | [WindowType](#windowtype) | Yes | Window type.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result.|
- Example
**Example**
```js
var type = window.TYPE_APP;
......@@ -853,19 +859,19 @@ This is a system API and cannot be called by third-party applications.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- | ---------- |
| type | [WindowType](#windowtype) | Yes | Window type.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var type = window.TYPE_APP;
......@@ -885,13 +891,13 @@ Obtains the properties of this window. This API uses an asynchronous callback to
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------------- | ---- | ------------------ |
| callback | AsyncCallback&lt;[WindowProperties](#windowproperties)&gt; | Yes | Callback used to return the window properties.|
- Example
**Example**
```js
windowClass.getProperties((err, data) => {
......@@ -911,13 +917,13 @@ Obtains the properties of this window. This API uses a promise to return the res
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| ---------------------------------------------------- | ------------------------------------- |
| Promise&lt;[WindowProperties](#windowproperties)&gt; | Promise used to return the window properties.|
- Example
**Example**
```js
let promise = windowClass.getProperties();
......@@ -936,14 +942,14 @@ Obtains the area where this window cannot be displayed, for example, the system
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var type = window.AvoidAreaType.TYPE_SYSTEM;
......@@ -964,19 +970,19 @@ Obtains the area where this window cannot be displayed, for example, the system
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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.|
- Return value
**Return value**
| Type | Description |
| -------------------------------------- | --------------------------------------------- |
| Promise&lt;[AvoidArea](#avoidarea)&gt; | Promise used to return the area.|
- Example
**Example**
```js
let promise = windowClass.getAvoidArea();
......@@ -995,14 +1001,14 @@ Sets whether to enable the full-screen mode for this window. This API uses an as
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var isFullScreen = true;
......@@ -1023,19 +1029,19 @@ Sets whether to enable the full-screen mode for this window. This API uses a pro
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var isFullScreen = true;
......@@ -1055,14 +1061,14 @@ Sets whether the window layout is in full-screen mode. This API uses an asynchro
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var isLayoutFullScreen= true;
......@@ -1083,19 +1089,19 @@ Sets whether the window layout is in full-screen mode. This API uses a promise t
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var isLayoutFullScreen = true;
......@@ -1115,14 +1121,14 @@ Sets whether to display the status bar and navigation bar in this window. This A
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var names = ["status", "navigation"];
......@@ -1143,19 +1149,19 @@ Sets whether to display the status bar and navigation bar in this window. This A
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var names = ["status", "navigation"];
......@@ -1175,14 +1181,14 @@ Sets the properties of the status bar and navigation bar in this window. This AP
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var SystemBarProperties={
......@@ -1212,19 +1218,19 @@ Sets the properties of the status bar and navigation bar in this window. This AP
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ------------------- | ------------------------------------------- | ---- | -------------------- |
| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes | Properties of the status bar and navigation bar.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var SystemBarProperties={
......@@ -1253,14 +1259,14 @@ Loads content to this window. This API uses an asynchronous callback to return t
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
windowClass.loadContent("pages/page2/page2", (err, data) => {
......@@ -1280,19 +1286,19 @@ Loads content to this window. This API uses a promise to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------- |
| path | string | Yes | Path of the page from which the content will be loaded.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
let promise = windowClass.loadContent("pages/page2/page2");
......@@ -1311,13 +1317,13 @@ Checks whether this window is displayed. This API uses an asynchronous callback
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the window is displayed.|
- Example
**Example**
```js
windowClass.isShowing((err, data) => {
......@@ -1337,13 +1343,13 @@ Checks whether this window is displayed. This API uses a promise to return the r
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| ---------------------- | ----------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return whether the window is displayed.|
- Example
**Example**
```js
let promise = windowClass.isShowing();
......@@ -1362,14 +1368,14 @@ Enables listening for window size changes.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | -------------------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **windowSizeChange**, indicating the window size change event.|
| callback | Callback&lt;[Size](#size)&gt; | Yes | Callback used to return the information. |
- Example
**Example**
```js
var type = 'windowSizeChange';
......@@ -1386,14 +1392,14 @@ Disables listening for window size changes.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | -------------------------------------------------------- |
| type | string | Yes | Type of event to listen for. The value is fixed at **windowSizeChange**, indicating the window size change event.|
| callback | Callback&lt;[Size](#size)&gt; | No | Callback used to return the information. |
- Example
**Example**
```js
var type = 'windowSizeChange';
......@@ -1408,14 +1414,14 @@ Enables listening for changes to the area where the window cannot be displayed.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of event to listen for. The value is fixed at **systemAvoidAreaChange**, indicating the event of changes to the area where the window cannot be displayed.|
| callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the information. |
- Example
**Example**
```js
var type = 'systemAvoidAreaChange';
......@@ -1432,14 +1438,14 @@ Disables listening for changes to the area where the window cannot be displayed.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of event to listen for. The value is fixed at **systemAvoidAreaChange**, indicating the event of changes to the area where the window cannot be displayed.|
| callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | No | Callback used to return the information. |
- Example
**Example**
```js
var type = 'systemAvoidAreaChange';
......@@ -1456,14 +1462,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of event to listen for. The value is fixed at **keyboardHeightChange**, indicating the keyboard height change event.|
| callback | Callbacknumber&gt; | Yes | Callback used to return the information. |
- Example
**Example**
```js
var type = 'keyboardHeightChange';
......@@ -1482,14 +1488,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of event to listen for. The value is fixed at **keyboardHeightChange**, indicating the keyboard height change event.|
| callback | Callback&lt;number&gt; | No | Callback used to return the information. |
- Example
**Example**
```js
var type = 'keyboardHeightChange';
......@@ -1504,13 +1510,13 @@ Checks whether this window supports the wide color gamut mode. This API uses an
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the wide color gamut mode is supported.|
- Example
**Example**
```js
windowClass.isSupportWideGamut((err, data) => {
......@@ -1530,13 +1536,13 @@ Checks whether this window supports the wide color gamut mode. This API uses a p
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| ---------------------- | ------------------------------------------------------------ |
| Promise&lt;boolean&gt; | Promise used to return whether the wide color gamut mode is supported.|
- Example
**Example**
```js
let promise = windowClass.isSupportWideGamut();
......@@ -1555,14 +1561,14 @@ Sets this window to the wide or default color gamut mode. This API uses an async
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err, data) => {
......@@ -1582,19 +1588,19 @@ Sets this window to the wide or default color gamut mode. This API uses a promis
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------- | ---- | ------------ |
| colorSpace | [ColorSpace](#colorspace) | Yes | Color gamut mode.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
let promise = windowClass.isSupportWideGamut(window.ColorSpace.WIDE_GAMUT);
......@@ -1613,13 +1619,13 @@ Obtains the color gamut mode of this window. This API uses an asynchronous callb
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | -------------------------- |
| callback | AsyncCallback&lt;[ColorSpace](#colorspace)&gt; | Yes | Callback used to return the color gamut mode obtained.|
- Example
**Example**
```js
windowClass.getColorSpace((err, data) => {
......@@ -1639,13 +1645,13 @@ Obtains the color gamut mode of this window. This API uses a promise to return t
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| ---------------------------------------- | ----------------------------------------- |
| Promise&lt;[ColorSpace](#colorspace)&gt; | Promise used to return the color gamut mode obtained.|
- Example
**Example**
```js
let promise = windowClass.getColorSpace();
......@@ -1666,14 +1672,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var color = '#00ff33';
......@@ -1696,19 +1702,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var color = '#00ff33';
......@@ -1730,14 +1736,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var brightness = 1;
......@@ -1760,19 +1766,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | ------------------------------------ |
| brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var brightness = 1;
......@@ -1794,14 +1800,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
windowClass.setDimBehind(0.5, (err, data) => {
......@@ -1823,19 +1829,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
let promise = windowClass.setDimBehind(0.5);
......@@ -1856,14 +1862,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var isFocusable= true;
......@@ -1886,19 +1892,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------- | ---- | ---------------------------- |
| isFocusable | boolean | Yes | Whether the window can gain focus.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var isFocusable= true;
......@@ -1920,14 +1926,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var isKeepScreenOn = true;
......@@ -1950,19 +1956,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------- | ---- | ------------------------ |
| isKeepScreenOn | boolean | Yes | Whether to keep the screen always on.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var isKeepScreenOn= true;
......@@ -1984,14 +1990,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
windowClass.setOutsideTouchable(true, (err, data) => {
......@@ -2013,19 +2019,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
let promise = windowClass.setOutsideTouchable(true);
......@@ -2046,14 +2052,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var isPrivacyMode = true;
......@@ -2077,19 +2083,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ------------- | ------- | ---- | -------------------- |
| isPrivacyMode | boolean | Yes | Whether the window is in privacy mode.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var isPrivacyMode = true;
......@@ -2111,14 +2117,14 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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. |
- Example
**Example**
```js
var isTouchable = true;
......@@ -2142,19 +2148,19 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------- | ---- | -------------------- |
| isTouchable | boolean | Yes | Whether the window is touchable.|
- Return value
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
- Example
**Example**
```js
var isTouchable = true;
......@@ -2191,13 +2197,13 @@ Obtains the main window of this window stage. This API uses a promise to return
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| -------------------------------- | ---------------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the main window.|
- Example
**Example**
```ts
class myAbility extends Ability {
......@@ -2223,13 +2229,13 @@ Obtains the main window of this window stage. This API uses an asynchronous call
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | --------------------------------------- |
| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes | Callback used to return the main window.|
- Example
**Example**
```ts
class myAbility extends Ability {
......@@ -2256,19 +2262,19 @@ Creates a subwindow for this window stage. This API uses a promise to return the
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------- |
| name | String | Yes | Name of the subwindow.|
- Return value
**Return value**
| Type | Description |
| -------------------------------- | ------------------------------------------------- |
| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow created.|
- Example
**Example**
```ts
class myAbility extends Ability {
......@@ -2294,14 +2300,14 @@ Creates a subwindow for this window stage. This API uses an asynchronous callbac
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**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.|
- Example
**Example**
```ts
class myAbility extends Ability {
......@@ -2329,13 +2335,13 @@ Obtains all the subwindows of this window stage. This API uses a promise to retu
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Return value
**Return value**
| Type | Description |
| --------------------------------------------- | ------------------------------------------------------------ |
| Promise&lt;Array&lt;[Window](#window)&gt;&gt; | Promise used to return all the subwindows.|
- Example
**Example**
```ts
class myAbility extends Ability {
......@@ -2361,13 +2367,13 @@ Obtains all the subwindows of this window stage. This API uses an asynchronous c
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ---- | ------------------------------------------- |
| callback | AsyncCallback&lt;Array&lt;[Window](#window)&gt;&gt; | Yes | Callback used to return all the subwindows.|
- Example
**Example**
```ts
class myAbility extends Ability {
......@@ -2392,16 +2398,16 @@ loadContent(path: string, callback: AsyncCallback&lt;void&gt;): void
Loads content to this window stage. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.WindowManager.WindowManager.Coretype with the value 'windowSizeChange'
**System capability**: SystemCapability.WindowManager.WindowManager.Coretype with the value **windowSizeChange**
- Parameters
**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. |
- Example
**Example**
```ts
class myAbility extends Ability {
......@@ -2426,14 +2432,14 @@ Enables listening for window stage lifecycle changes.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of event to listen for. The value is fixed at **windowStageEvent**, indicating the window stage lifecycle change event.|
| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | Yes | Callback used to return the information. |
- Example
**Example**
```ts
class myAbility extends Ability {
......@@ -2455,14 +2461,14 @@ Disables listening for window stage lifecycle changes.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Type of event to listen for. The value is fixed at **windowStageEvent**, indicating the window stage lifecycle change event.|
| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | No | Callback used to return the information. |
- Example
**Example**
```ts
class myAbility extends Ability {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册