From e6a36f6c4da8bc39f0110665f7f086f3175c4536 Mon Sep 17 00:00:00 2001 From: duyufan Date: Wed, 6 Sep 2023 10:20:03 +0000 Subject: [PATCH] modify arkTs Signed-off-by: duyufan Change-Id: Id578ab2954b04ff93d66b0f39df2e7bacda6d6b8 --- .../reference/apis/js-apis-devicestatus-cooperate.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-devicestatus-cooperate.md b/zh-cn/application-dev/reference/apis/js-apis-devicestatus-cooperate.md index 1536940199..9cc8203450 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-devicestatus-cooperate.md +++ b/zh-cn/application-dev/reference/apis/js-apis-devicestatus-cooperate.md @@ -12,7 +12,6 @@ ```ts import cooperate from '@ohos.cooperate' -import BusinessError from '@ohos.base' ``` ## cooperate.prepare @@ -32,6 +31,7 @@ prepare(callback: AsyncCallback<void>): void; **示例**: ```ts +import BusinessError from '@ohos.base'; try { cooperate.prepare((error: BusinessError) => { if (error) { @@ -64,6 +64,7 @@ prepare(): Promise<void> **示例**: ```ts +import BusinessError from '@ohos.base'; try { cooperate.prepare().then(() => { console.log(`Keyboard mouse crossing prepare success.`); @@ -91,6 +92,7 @@ unprepare(callback: AsyncCallback<void>): void; **示例**: ```ts +import BusinessError from '@ohos.base'; try { cooperate.unprepare((error: BusinessError) => { if (error) { @@ -119,6 +121,7 @@ unprepare(): Promise<void>; | Promise<void> | 无返回结果的Promise对象。 | ```ts +import BusinessError from '@ohos.base'; try { cooperate.unprepare().then(() => { console.log(`Keyboard mouse crossing unprepare success.`); @@ -158,6 +161,7 @@ activate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback **示例**: ```ts +import BusinessError from '@ohos.base'; let targetNetworkId = "networkId"; let inputDeviceId = 0; try { @@ -207,6 +211,7 @@ activate(targetNetworkId: string, inputDeviceId: number): Promise<void>; **示例**: ```ts +import BusinessError from '@ohos.base'; let targetNetworkId = "networkId"; let inputDeviceId = 0; try { @@ -240,6 +245,7 @@ deactivate(isUnchained: boolean, callback: AsyncCallback<void>): void; **示例**: ```ts +import BusinessError from '@ohos.base'; try { cooperate.deactivate(false, (error: BusinessError) => { if (error) { @@ -280,6 +286,7 @@ deactivate(isUnchained: boolean): Promise<void>; **示例**: ```ts +import BusinessError from '@ohos.base'; try { cooperate.deactivate(false).then(() => { console.log(`Stop Keyboard mouse crossing success.`); @@ -309,6 +316,7 @@ getCrossingSwitchState(networkId: string, callback: AsyncCallback<boolean> **示例**: ```ts +import BusinessError from '@ohos.base'; let deviceDescriptor = "networkId"; try { cooperate.getCrossingSwitchState(deviceDescriptor, (error: BusinessError, data: boolean) => { @@ -350,6 +358,7 @@ getCrossingSwitchState(networkId: string): Promise<boolean>; **示例**: ```ts +import BusinessError from '@ohos.base'; let deviceDescriptor = "networkId"; try { cooperate.getCrossingSwitchState(deviceDescriptor).then((data: boolean) => { -- GitLab