diff --git a/zh-cn/application-dev/reference/apis/js-apis-screen.md b/zh-cn/application-dev/reference/apis/js-apis-screen.md index ec90213b049c0a140bea2d3837d6ee697ddab435..be5d3e8e638f88ca3e410c163e20894af9813d38 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screen.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screen.md @@ -224,6 +224,89 @@ try { }; ``` +## screen.stopExpand10+ + +stopExpand(expandScreen:Array<number>, callback: AsyncCallback<void>): void + +停止屏幕的扩展模式,使用callback异步回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | --------------------------- | --- | -------------------------------------------------------------- | +| expandScreen | Array<number> | 是 | 扩展屏幕id集合。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当停止屏幕扩展模式成功,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.stopExpand10+ + +stopExpand(expandScreen:Array<number>): Promise<void> + +停止屏幕的扩展模式,使用Promise异步回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ------------------- | --- | --------------- | +| expandScreen | Array<number> | 是 | 扩展屏幕id集合。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ----------------------- | +| Promise<void> | 无返回结果的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<number>, callback: AsyncCallback<number>): void @@ -311,6 +394,89 @@ try { }; ``` +## screen.stopMirror10+ + +stopMirror(mirrorScreen:Array<number>, callback: AsyncCallback<void>): void + +停止屏幕的镜像模式,使用callback异步回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | --------------------------- | --- | -------------------------------------------------------------- | +| mirrorScreen | Array<number> | 是 | 镜像屏幕id集合。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当停止屏幕镜像模式成功,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.stopMirror10+ + +stopMirror(mirrorScreen:Array<number>): Promise<void> + +停止屏幕的镜像模式,使用Promise异步回调。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ------------------- | --- | --------------- | +| mirrorScreen | Array<number> | 是 | 镜像屏幕id集合。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ----------------------- | +| Promise<void> | 无返回结果的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<Screen>): void