未验证 提交 0296da51 编写于 作者: O openharmony_ci 提交者: Gitee

!18069 新增停止镜像屏和停止扩展屏接口

Merge pull request !18069 from ZhengJiangliang/master
......@@ -224,6 +224,89 @@ try {
};
```
## screen.stopExpand<sup>10+</sup>
stopExpand(expandScreen:Array&lt;number&gt;, callback: AsyncCallback&lt;void&gt;): void
停止屏幕的扩展模式,使用callback异步回调。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | --------------------------- | --- | -------------------------------------------------------------- |
| expandScreen | Array&lt;number&gt; | 是 | 扩展屏幕id集合。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当停止屏幕扩展模式成功,err为undefined,否则为错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[屏幕错误码](../errorcodes/errorcode-display.md)
| 错误码ID | 错误信息 |
| ------- | ----------------------- |
| 1400001 | Invalid display or screen. |
**示例:**
```js
try {
let expandScreenIds = [1, 2, 3];
screen.stopExpand(expandScreenIds, (err) => {
if (err.code) {
console.error('Failed to stop expand screens. Code:' + JSON.stringify(err));
return;
}
console.info('Succeeded in stopping expand screens.');
});
} catch (exception) {
console.error('Failed to stop expand screens. Code: ' + JSON.stringify(exception));
};
```
## screen.stopExpand<sup>10+</sup>
stopExpand(expandScreen:Array&lt;number&gt;): Promise&lt;void&gt;
停止屏幕的扩展模式,使用Promise异步回调。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------- | --- | --------------- |
| expandScreen | Array&lt;number&gt; | 是 | 扩展屏幕id集合。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ----------------------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**错误码:**
以下错误码的详细介绍请参见[屏幕错误码](../errorcodes/errorcode-display.md)
| 错误码ID | 错误信息 |
| ------- | ----------------------- |
| 1400001 | Invalid display or screen. |
**示例:**
```js
try {
let expandScreenIds = [1, 2, 3];
screen.stopExpand(expandScreenIds).then(() => {
console.info('Succeeded in stopping expand screens.');
}).catch((err) => {
console.error('Failed to stop expand screens. Code:' + JSON.stringify(err));
});
} catch (exception) {
console.error('Failed to stop expand screens. Code:' + JSON.stringify(exception));
};
```
## screen.makeMirror
makeMirror(mainScreen:number, mirrorScreen:Array&lt;number&gt;, callback: AsyncCallback&lt;number&gt;): void
......@@ -311,6 +394,89 @@ try {
};
```
## screen.stopMirror<sup>10+</sup>
stopMirror(mirrorScreen:Array&lt;number&gt;, callback: AsyncCallback&lt;void&gt;): void
停止屏幕的镜像模式,使用callback异步回调。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | --------------------------- | --- | -------------------------------------------------------------- |
| mirrorScreen | Array&lt;number&gt; | 是 | 镜像屏幕id集合。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当停止屏幕镜像模式成功,err为undefined,否则为错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[屏幕错误码](../errorcodes/errorcode-display.md)
| 错误码ID | 错误信息 |
| ------- | ----------------------- |
| 1400001 | Invalid display or screen. |
**示例:**
```js
try {
let mirrorScreenIds = [1, 2, 3];
screen.stopMirror(mirrorScreenIds, (err) => {
if (err.code) {
console.error('Failed to stop mirror screens. Code:' + JSON.stringify(err));
return;
}
console.info('Succeeded in stopping mirror screens.');
});
} catch (exception) {
console.error('Failed to stop mirror screens. Code: ' + JSON.stringify(exception));
};
```
## screen.stopMirror<sup>10+</sup>
stopMirror(mirrorScreen:Array&lt;number&gt;): Promise&lt;void&gt;
停止屏幕的镜像模式,使用Promise异步回调。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------- | --- | --------------- |
| mirrorScreen | Array&lt;number&gt; | 是 | 镜像屏幕id集合。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ----------------------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**错误码:**
以下错误码的详细介绍请参见[屏幕错误码](../errorcodes/errorcode-display.md)
| 错误码ID | 错误信息 |
| ------- | ----------------------- |
| 1400001 | Invalid display or screen. |
**示例:**
```js
try {
let mirrorScreenIds = [1, 2, 3];
screen.stopMirror(mirrorScreenIds).then(() => {
console.info('Succeeded in stopping mirror screens.');
}).catch((err) => {
console.error('Failed to stop mirror screens. Code:' + JSON.stringify(err));
});
} catch (exception) {
console.error('Failed to stop mirror screens. Code:' + JSON.stringify(exception));
};
```
## screen.createVirtualScreen
createVirtualScreen(options:VirtualScreenOption, callback: AsyncCallback&lt;Screen&gt;): void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册