提交 e6a36f6c 编写于 作者: D duyufan

modify arkTs

Signed-off-by: Nduyufan <duyufan1@huawei.com>
Change-Id: Id578ab2954b04ff93d66b0f39df2e7bacda6d6b8
上级 362da98c
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
```ts ```ts
import cooperate from '@ohos.cooperate' import cooperate from '@ohos.cooperate'
import BusinessError from '@ohos.base'
``` ```
## cooperate.prepare ## cooperate.prepare
...@@ -32,6 +31,7 @@ prepare(callback: AsyncCallback&lt;void&gt;): void; ...@@ -32,6 +31,7 @@ prepare(callback: AsyncCallback&lt;void&gt;): void;
**示例** **示例**
```ts ```ts
import BusinessError from '@ohos.base';
try { try {
cooperate.prepare((error: BusinessError) => { cooperate.prepare((error: BusinessError) => {
if (error) { if (error) {
...@@ -64,6 +64,7 @@ prepare(): Promise&lt;void&gt; ...@@ -64,6 +64,7 @@ prepare(): Promise&lt;void&gt;
**示例** **示例**
```ts ```ts
import BusinessError from '@ohos.base';
try { try {
cooperate.prepare().then(() => { cooperate.prepare().then(() => {
console.log(`Keyboard mouse crossing prepare success.`); console.log(`Keyboard mouse crossing prepare success.`);
...@@ -91,6 +92,7 @@ unprepare(callback: AsyncCallback&lt;void&gt;): void; ...@@ -91,6 +92,7 @@ unprepare(callback: AsyncCallback&lt;void&gt;): void;
**示例** **示例**
```ts ```ts
import BusinessError from '@ohos.base';
try { try {
cooperate.unprepare((error: BusinessError) => { cooperate.unprepare((error: BusinessError) => {
if (error) { if (error) {
...@@ -119,6 +121,7 @@ unprepare(): Promise&lt;void&gt;; ...@@ -119,6 +121,7 @@ unprepare(): Promise&lt;void&gt;;
| Promise&lt;void&gt; | 无返回结果的Promise对象。 | | Promise&lt;void&gt; | 无返回结果的Promise对象。 |
```ts ```ts
import BusinessError from '@ohos.base';
try { try {
cooperate.unprepare().then(() => { cooperate.unprepare().then(() => {
console.log(`Keyboard mouse crossing unprepare success.`); console.log(`Keyboard mouse crossing unprepare success.`);
...@@ -158,6 +161,7 @@ activate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback ...@@ -158,6 +161,7 @@ activate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback
**示例** **示例**
```ts ```ts
import BusinessError from '@ohos.base';
let targetNetworkId = "networkId"; let targetNetworkId = "networkId";
let inputDeviceId = 0; let inputDeviceId = 0;
try { try {
...@@ -207,6 +211,7 @@ activate(targetNetworkId: string, inputDeviceId: number): Promise&lt;void&gt;; ...@@ -207,6 +211,7 @@ activate(targetNetworkId: string, inputDeviceId: number): Promise&lt;void&gt;;
**示例** **示例**
```ts ```ts
import BusinessError from '@ohos.base';
let targetNetworkId = "networkId"; let targetNetworkId = "networkId";
let inputDeviceId = 0; let inputDeviceId = 0;
try { try {
...@@ -240,6 +245,7 @@ deactivate(isUnchained: boolean, callback: AsyncCallback&lt;void&gt;): void; ...@@ -240,6 +245,7 @@ deactivate(isUnchained: boolean, callback: AsyncCallback&lt;void&gt;): void;
**示例** **示例**
```ts ```ts
import BusinessError from '@ohos.base';
try { try {
cooperate.deactivate(false, (error: BusinessError) => { cooperate.deactivate(false, (error: BusinessError) => {
if (error) { if (error) {
...@@ -280,6 +286,7 @@ deactivate(isUnchained: boolean): Promise&lt;void&gt;; ...@@ -280,6 +286,7 @@ deactivate(isUnchained: boolean): Promise&lt;void&gt;;
**示例** **示例**
```ts ```ts
import BusinessError from '@ohos.base';
try { try {
cooperate.deactivate(false).then(() => { cooperate.deactivate(false).then(() => {
console.log(`Stop Keyboard mouse crossing success.`); console.log(`Stop Keyboard mouse crossing success.`);
...@@ -309,6 +316,7 @@ getCrossingSwitchState(networkId: string, callback: AsyncCallback&lt;boolean&gt; ...@@ -309,6 +316,7 @@ getCrossingSwitchState(networkId: string, callback: AsyncCallback&lt;boolean&gt;
**示例** **示例**
```ts ```ts
import BusinessError from '@ohos.base';
let deviceDescriptor = "networkId"; let deviceDescriptor = "networkId";
try { try {
cooperate.getCrossingSwitchState(deviceDescriptor, (error: BusinessError, data: boolean) => { cooperate.getCrossingSwitchState(deviceDescriptor, (error: BusinessError, data: boolean) => {
...@@ -350,6 +358,7 @@ getCrossingSwitchState(networkId: string): Promise&lt;boolean&gt;; ...@@ -350,6 +358,7 @@ getCrossingSwitchState(networkId: string): Promise&lt;boolean&gt;;
**示例** **示例**
```ts ```ts
import BusinessError from '@ohos.base';
let deviceDescriptor = "networkId"; let deviceDescriptor = "networkId";
try { try {
cooperate.getCrossingSwitchState(deviceDescriptor).then((data: boolean) => { cooperate.getCrossingSwitchState(deviceDescriptor).then((data: boolean) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册