diff --git a/en/application-dev/reference/apis/js-apis-featureAbility.md b/en/application-dev/reference/apis/js-apis-featureAbility.md
index d76a6e047663ddf810ffe0ae167fc33e11f06b81..b57f529219338640cc0494bd24611063bcc4661d 100644
--- a/en/application-dev/reference/apis/js-apis-featureAbility.md
+++ b/en/application-dev/reference/apis/js-apis-featureAbility.md
@@ -1,6 +1,6 @@
# FeatureAbility Module (JavaScript)
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> 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.
## Constraints
@@ -17,7 +17,7 @@ import featureAbility from '@ohos.ability.featureAbility'
startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\): void
-Starts an ability. This method uses a callback to return the result.
+Starts an ability. This API uses a callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -42,8 +42,9 @@ featureAbility.startAbility(
type: "",
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
- bundleName: "com.example.startability",
- abilityName: "com.example.startability.MainAbility",
+ bundleName: "com.example.myapplication",
+ /* In the FA model, abilityName consists of package and ability name. */
+ abilityName: "com.example.entry.secondAbility",,
uri: ""
},
},
@@ -56,7 +57,7 @@ featureAbility.startAbility(
startAbility(parameter: StartAbilityParameter): Promise\
-Starts an ability. This method uses a promise to return the result.
+Starts an ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -80,8 +81,9 @@ featureAbility.startAbility(
type: "MIMETYPE",
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
- bundleName: "com.example.startability",
- abilityName: "com.example.startability.MainAbility",
+ bundleName: "com.example.myapplication",
+ /* In the FA model, abilityName consists of package and ability name. */
+ abilityName: "com.example.entry.secondAbility",
uri: ""
},
}
@@ -123,7 +125,7 @@ featureAbility.acquireDataAbilityHelper(
startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback\): void
-Starts an ability. This method uses a callback to return the execution result when the ability is destroyed.
+Starts an ability. This API uses a callback to return the execution result when the ability is destroyed.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -148,8 +150,9 @@ featureAbility.startAbilityForResult(
type: "MIMETYPE",
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
- bundleName: "com.example.featureabilitytest",
- abilityName: "com.example.featureabilitytest.MainAbility",
+ bundleName: "com.example.myapplication",
+ /* In the FA model, abilityName consists of package and ability name. */
+ abilityName: "com.example.entry.secondAbility",
uri:""
},
},
@@ -163,7 +166,7 @@ featureAbility.startAbilityForResult(
startAbilityForResult(parameter: StartAbilityParameter): Promise\
-Starts an ability. This method uses a promise to return the execution result when the ability is destroyed.
+Starts an ability. This API uses a promise to return the execution result when the ability is destroyed.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -193,8 +196,9 @@ featureAbility.startAbilityForResult(
type: "MIMETYPE",
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
- bundleName: "com.example.featureabilitytest",
- abilityName: "com.example.featureabilitytest.MainAbility",
+ bundleName: "com.example.myapplication",
+ /* In the FA model, abilityName consists of package and ability name. */
+ abilityName: "com.example.entry.secondAbility",
uri:"",
parameters:
{
@@ -219,7 +223,7 @@ featureAbility.startAbilityForResult(
terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback\): void
-Destroys this Page ability, with the result code and data sent to the caller. This method uses a callback to return the result.
+Destroys this Page ability, with the result code and data sent to the caller. This API uses a callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -245,8 +249,9 @@ featureAbility.terminateSelfWithResult(
type: "MIMETYPE",
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
- bundleName: "com.example.featureabilitytest",
- abilityName: "com.example.featureabilitytest.MainAbility",
+ bundleName: "com.example.myapplication",
+ /* In the FA model, abilityName consists of package and ability name. */
+ abilityName: "com.example.entry.secondAbility",
uri:"",
parameters: {
mykey0: 2222,
@@ -267,7 +272,7 @@ featureAbility.terminateSelfWithResult(
terminateSelfWithResult(parameter: AbilityResult): Promise\
-Destroys this Page ability, with the result code and data sent to the caller. This method uses a promise to return the result.
+Destroys this Page ability, with the result code and data sent to the caller. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -298,8 +303,9 @@ featureAbility.terminateSelfWithResult(
type: "MIMETYPE",
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
- bundleName: "com.example.featureabilitytest",
- abilityName: "com.example.featureabilitytest.MainAbility",
+ bundleName: "com.example.myapplication",
+ /* In the FA model, abilityName consists of package and ability name. */
+ abilityName: "com.example.entry.secondAbility",
uri:"",
parameters: {
mykey0: 2222,
@@ -324,7 +330,7 @@ featureAbility.terminateSelfWithResult(
hasWindowFocus(callback: AsyncCallback\): void
-Checks whether the main window of this ability has the focus. This method uses a callback to return the result.
+Checks whether the main window of this ability has the focus. This API uses a callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -347,7 +353,7 @@ featureAbility.hasWindowFocus()
hasWindowFocus(): Promise\
-Checks whether the main window of this ability has the focus. This method uses a promise to return the result.
+Checks whether the main window of this ability has the focus. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -372,7 +378,7 @@ featureAbility.hasWindowFocus().then((data) => {
getWant(callback: AsyncCallback\): void
-Obtains the **Want** object sent from this ability. This method uses a callback to return the result.
+Obtains the **Want** object sent from this ability. This API uses a callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -395,7 +401,7 @@ featureAbility.getWant()
getWant(): Promise\
-Obtains the **Want** object sent from this ability. This method uses a promise to return the result.
+Obtains the **Want** object sent from this ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -442,7 +448,7 @@ context.getBundleName()
terminateSelf(callback: AsyncCallback\): void
-Destroys this Page ability, with the result code and data sent to the caller. This method uses a callback to return the result.
+Destroys this Page ability, with the result code and data sent to the caller. This API uses a callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -465,7 +471,7 @@ featureAbility.terminateSelf()
terminateSelf(): Promise\
-Destroys this Page ability, with the result code and data sent to the caller. This method uses a promise to return the result.
+Destroys this Page ability, with the result code and data sent to the caller. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -488,7 +494,7 @@ featureAbility.terminateSelf().then((data) => {
connectAbility(request: Want, options:ConnectOptions): number
-Connects this ability to a specific Service ability. This method uses a callback to return the result.
+Connects this ability to a specific Service ability. This API uses a callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -557,7 +563,7 @@ var connId = featureAbility.connectAbility(
disconnectAbility(connection: number, callback:AsyncCallback\): void
-Disconnects this ability from a specific Service ability. This method uses a callback to return the result.
+Disconnects this ability from a specific Service ability. This API uses a callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -604,7 +610,7 @@ var result = featureAbility.disconnectAbility(connId,
disconnectAbility(connection: number): Promise\
-Disconnects this ability from a specific Service ability. This method uses a promise to return the result.
+Disconnects this ability from a specific Service ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -656,7 +662,7 @@ featureAbility.disconnectAbility(connId).then((error,data) => {
getWindow(callback: AsyncCallback\): void
-Obtains the window corresponding to this ability. This method uses a callback to return the result.
+Obtains the window corresponding to this ability. This API uses a callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
@@ -676,7 +682,7 @@ featureAbility.getWindow()
getWindow(): Promise\;
-Obtains the window corresponding to this ability. This method uses a promise to return the result.
+Obtains the window corresponding to this ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
diff --git a/en/application-dev/reference/apis/js-apis-pasteboard.md b/en/application-dev/reference/apis/js-apis-pasteboard.md
index 6d19f07c022a2aa2a3fdd6163f2d7f45cb5c1ed3..c5ca90fd33c1de4b2eb4f4fff33eee5e2d899a79 100644
--- a/en/application-dev/reference/apis/js-apis-pasteboard.md
+++ b/en/application-dev/reference/apis/js-apis-pasteboard.md
@@ -1,9 +1,8 @@
# Pasteboard
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
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.
>
-> 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.
## Modules to Import
@@ -20,11 +19,11 @@ import pasteboard from '@ohos.pasteboard';
| Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- |
-| MAX_RECORD_NUM7+ | number | Yes | No | Maximum number of records allowed in a **PasteData** object. |
-| MIMETYPE_TEXT_HTML7+ | string | Yes | No | MIME type of the HTML text. |
-| MIMETYPE_TEXT_WANT7+ | string | Yes | No | MIME type of the Want text. |
-| MIMETYPE_TEXT_PLAIN7+ | string | Yes | No | MIME type of the plain text. |
-| MIMETYPE_TEXT_URI7+ | string | Yes | No | MIME type of the URI text. |
+| MAX_RECORD_NUM7+ | number | Yes | No | Maximum number of records allowed in a **PasteData** object. |
+| MIMETYPE_TEXT_HTML7+ | string | Yes | No | MIME type of the HTML text. |
+| MIMETYPE_TEXT_WANT7+ | string | Yes | No | MIME type of the Want text. |
+| MIMETYPE_TEXT_PLAIN7+ | string | Yes | No | MIME type of the plain text. |
+| MIMETYPE_TEXT_URI7+ | string | Yes | No | MIME type of the URI text. |
## pasteboard.createPlainTextData
@@ -35,21 +34,23 @@ Creates a **PasteData** object for plain text.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | text | string | Yes | Plain text. |
+**Parameters**
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteData](#pastedata) | **PasteData** object with the specified content. |
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| text | string | Yes | Plain text. |
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("content");
- ```
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| [PasteData](#pastedata) | **PasteData** object with the specified content. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("content");
+```
## pasteboard.createHtmlData7+
@@ -60,22 +61,24 @@ Creates a **PasteData** object for HTML text.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | htmlText | string | Yes | HTML text. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| htmlText | string | Yes | HTML text. |
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteData](#pastedata) | **PasteData** object with the specified content. |
+**Return value**
-- Example
-
- ```
- var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
- var pasteData = pasteboard.createHtmlData(html);
- ```
+| Type | Description |
+| -------- | -------- |
+| [PasteData](#pastedata) | **PasteData** object with the specified content. |
+
+**Example**
+
+```js
+var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
+var pasteData = pasteboard.createHtmlData(html);
+```
## pasteboard.createWantData7+
@@ -86,25 +89,27 @@ Creates a **PasteData** object for Want text.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | want | [Want](js-apis-application-Want.md) | Yes | Want text. |
+**Parameters**
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteData](#pastedata) | **PasteData** object with the specified content. |
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes | Want text. |
-- Example
-
- ```
- var object = {
- bundleName: "com.example.aafwk.test",
- abilityName: "com.example.aafwk.test.TwoAbility"
- };
- var pasteData = pasteboard.createWantData(object);
- ```
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| [PasteData](#pastedata) | **PasteData** object with the specified content. |
+
+**Example**
+
+```js
+var object = {
+ bundleName: "com.example.aafwk.test",
+ abilityName: "com.example.aafwk.test.TwoAbility"
+};
+var pasteData = pasteboard.createWantData(object);
+```
## pasteboard.createUriData7+
@@ -115,21 +120,23 @@ Creates a **PasteData** object for URI text.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | uri | string | Yes | URI text. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| uri | string | Yes | URI text. |
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteData](#pastedata) | **PasteData** object with the specified content. |
+**Return value**
-- Example
-
- ```
- var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt");
- ```
+| Type | Description |
+| -------- | -------- |
+| [PasteData](#pastedata) | **PasteData** object with the specified content. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt");
+```
## pasteboard.createPlainTextRecord7+
@@ -140,21 +147,23 @@ Creates a **PasteDataRecord** object of the plain text type.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | text | string | Yes | Plain text. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| text | string | Yes | Plain text. |
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteDataRecord](#pastedatarecord7) | New plain text record. |
+**Return value**
-- Example
-
- ```
- var record = pasteboard.createPlainTextRecord("hello");
- ```
+| Type | Description |
+| -------- | -------- |
+| [PasteDataRecord](#pastedatarecord7) | New plain text record. |
+
+**Example**
+
+```js
+var record = pasteboard.createPlainTextRecord("hello");
+```
## pasteboard.createHtmlTextRecord7+
@@ -165,22 +174,24 @@ Creates a **PasteDataRecord** object of the HTML text type.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | htmlText | string | Yes | HTML text. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| htmlText | string | Yes | HTML text. |
+
+**Return value**
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteDataRecord](#pastedatarecord7) | New HTML record. |
+| Type | Description |
+| -------- | -------- |
+| [PasteDataRecord](#pastedatarecord7) | New HTML record. |
-- Example
-
- ```
- var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
- var record = pasteboard.createHtmlTextRecord(html);
- ```
+**Example**
+
+```js
+var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
+var record = pasteboard.createHtmlTextRecord(html);
+```
## pasteboard.createWantRecord7+
@@ -191,25 +202,27 @@ Creates a **PasteDataRecord** object of the Want text type.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | want | [Want](js-apis-application-Want.md) | Yes | Want text. |
+**Parameters**
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteDataRecord](#pastedatarecord7) | New Want record. |
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes | Want text. |
-- Example
-
- ```
- var object = {
- bundleName: "com.example.aafwk.test",
- abilityName: "com.example.aafwk.test.TwoAbility"
- };
- var record = pasteboard.createWantRecord(object);
- ```
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| [PasteDataRecord](#pastedatarecord7) | New Want record. |
+
+**Example**
+
+```js
+var object = {
+ bundleName: "com.example.aafwk.test",
+ abilityName: "com.example.aafwk.test.TwoAbility"
+};
+var record = pasteboard.createWantRecord(object);
+```
## pasteboard.createUriRecord7+
@@ -220,21 +233,23 @@ Creates a **PasteDataRecord** object of the URI text type.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | uri | string | Yes | URI text. |
+**Parameters**
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteDataRecord](#pastedatarecord7) | New URI record. |
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| uri | string | Yes | URI text. |
-- Example
-
- ```
- var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
- ```
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| [PasteDataRecord](#pastedatarecord7) | New URI record. |
+
+**Example**
+
+```js
+var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
+```
## PasteDataProperty7+
@@ -245,11 +260,11 @@ Defines the properties of all data records on the pasteboard, including the time
| Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- |
-| additions | {[key: string]: object} | Yes | Yes | Additional property data. |
-| mimeTypes | Array<string> | Yes | No | Non-repeating data types of the data records on the pasteboard. |
-| tag | string | Yes | Yes | User-defined tag. |
-| timestamp | number | Yes | No | Timestamp at which the data is written to the pasteboard, in milliseconds. |
-| localOnly | boolean | Yes | Yes | Whether local access only is set for the pasteboard.
- The default value is **true**.
- **true**: The **PasteData** is set for local access only.
- **false**: The **PasteData** can be shared between devices. |
+| additions | {[key: string]: object} | Yes | Yes | Additional property data. |
+| mimeTypes | Array<string> | Yes | No | Non-repeating data types of the data records on the pasteboard. |
+| tag | string | Yes | Yes | User-defined tag. |
+| timestamp | number | Yes | No | Timestamp at which the data is written to the pasteboard, in milliseconds. |
+| localOnly | boolean | Yes | Yes | Whether local access only is set for the pasteboard.
- The default value is **true**.
- **true**: The **PasteData** is set for local access only.
- **false**: The **PasteData** can be shared between devices. |
## PasteDataRecord7+
@@ -263,63 +278,65 @@ A data record is an abstract definition of the content on the pasteboard. The pa
| Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- |
-| htmlText7+ | string | Yes | No | HTML text. |
-| want7+ | [Want](js-apis-application-Want.md) | Yes | No | Want text. |
-| mimeType7+ | string | Yes | No | Data type. |
-| plainText7+ | string | Yes | No | Plain text. |
-| uri7+ | string | Yes | No | URI text. |
+| htmlText7+ | string | Yes | No | HTML text. |
+| want7+ | [Want](js-apis-application-Want.md) | Yes | No | Want text. |
+| mimeType7+ | string | Yes | No | Data type. |
+| plainText7+ | string | Yes | No | Plain text. |
+| uri7+ | string | Yes | No | URI text. |
### convertToText7+
convertToText(): Promise<string>
-Forcibly converts the content in this **PasteData** object to the plain text. This method uses a promise to return the result.
+Forcibly converts the content in this **PasteData** object to the plain text. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | Promise<void> | Promise used to return the result. If the operation is successful, the plain text content after conversion is returned. Otherwise, error information is returned. |
+**Return value**
-- Example
-
- ```
- var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
- record.convertToText().then((data) => {
- console.info('convertToText success data : ' + JSON.stringify(data));
- }).catch((error) => {
- console.error('convertToText failed because ' + JSON.stringify(error));
- });
- ```
+| Type | Description |
+| -------- | -------- |
+| Promise<void> | Promise used to return the result. If the operation is successful, the plain text content after conversion is returned. Otherwise, error information is returned. |
+
+**Example**
+
+```js
+var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
+record.convertToText().then((data) => {
+ console.info('convertToText success data : ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('convertToText failed because ' + JSON.stringify(error));
+});
+```
### convertToText7+
convertToText(callback: AsyncCallback<string>): void
-Forcibly converts the content in this **PasteData** object to the plain text. This method uses an asynchronous callback to return the result.
+Forcibly converts the content in this **PasteData** object to the plain text. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<string> | Yes | Callback used to return the result. If this callback is successful, the plain text content after conversion is returned. Otherwise, error information is returned. |
-
-- Example
-
- ```
- var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
- record.convertToText((err, data) => {
- if (err) {
- console.error('convertToText failed because ' + JSON.stringify(err));
- return;
- }
- console.info('convertToText success data : ' + JSON.stringify(data));
- });
- ```
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<string> | Yes | Callback used to return the result. If this callback is successful, the plain text content after conversion is returned. Otherwise, error information is returned. |
+
+**Example**
+
+```js
+var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
+record.convertToText((err, data) => {
+ if (err) {
+ console.error('convertToText failed because ' + JSON.stringify(err));
+ return;
+ }
+ console.info('convertToText success data : ' + JSON.stringify(data));
+});
+```
## PasteData
@@ -340,22 +357,19 @@ Obtains the plain text of the primary record.
**System capability**: SystemCapability.MiscServices.Pasteboard
+**Return value**
-- Parameters
- None
+| Type | Description |
+| -------- | -------- |
+| string | Plain text. |
-- Return values
- | Type | Description |
- | -------- | -------- |
- | string | Plain text. |
+**Example**
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var plainText = pasteData.getPrimaryText();
- ```
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var plainText = pasteData.getPrimaryText();
+```
### getPrimaryHtml7+
@@ -366,18 +380,19 @@ Obtains the HTML text of the primary record.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | string | HTML text. |
+**Return value**
-- Example
-
- ```
- var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
- var pasteData = pasteboard.createHtmlData(html);
- var htmlText = pasteData.getPrimaryHtml();
- ```
+| Type | Description |
+| -------- | -------- |
+| string | HTML text. |
+
+**Example**
+
+```js
+var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
+var pasteData = pasteboard.createHtmlData(html);
+var htmlText = pasteData.getPrimaryHtml();
+```
### getPrimaryWant7+
@@ -388,21 +403,22 @@ Obtains the **Want** object of the primary record.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [Want](js-apis-featureAbility.md#want) | Want object. |
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| [Want](js-apis-application-Want.md) | Want object. |
+
+**Example**
-- Example
-
- ```
- var object = {
- bundleName: "com.example.aafwk.test",
- abilityName: "com.example.aafwk.test.TwoAbility"
- };
- var pasteData = pasteboard.createWantData(object);
- var want = pasteData.getPrimaryWant();
- ```
+```js
+var object = {
+ bundleName: "com.example.aafwk.test",
+ abilityName: "com.example.aafwk.test.TwoAbility"
+};
+var pasteData = pasteboard.createWantData(object);
+var want = pasteData.getPrimaryWant();
+```
### getPrimaryUri7+
@@ -413,17 +429,18 @@ Obtains the URI text of the primary record.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | string | URI text. |
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| string | URI text. |
-- Example
-
- ```
- var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt");
- var uri = pasteData.getPrimaryUri();
- ```
+**Example**
+
+```js
+var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt");
+var uri = pasteData.getPrimaryUri();
+```
### addTextRecord7+
@@ -436,17 +453,18 @@ The pasteboard supports a maximum number of 128 data records.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | text | string | Yes | Plain text. |
+**Parameters**
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- pasteData.addTextRecord("good");
- ```
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| text | string | Yes | Plain text. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+pasteData.addTextRecord("good");
+```
### addHtmlRecord7+
@@ -459,18 +477,19 @@ The pasteboard supports a maximum number of 128 data records.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | htmlText | string | Yes | HTML text. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| htmlText | string | Yes | HTML text. |
+
+**Example**
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
- pasteData.addHtmlRecord(html);
- ```
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
+pasteData.addHtmlRecord(html);
+```
### addWantRecord7+
@@ -483,21 +502,22 @@ The pasteboard supports a maximum number of 128 data records.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | want | [Want](js-apis-featureAbility.md#want) | Yes | Want object. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes | Want object. |
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var object = {
- bundleName: "com.example.aafwk.test",
- abilityName: "com.example.aafwk.test.TwoAbility"
- };
- pasteData.addWantRecord(object);
- ```
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var object = {
+ bundleName: "com.example.aafwk.test",
+ abilityName: "com.example.aafwk.test.TwoAbility"
+};
+pasteData.addWantRecord(object);
+```
### addUriRecord7+
@@ -510,17 +530,18 @@ The pasteboard supports a maximum number of 128 data records.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | uri | string | Yes | URI text. |
+**Parameters**
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- pasteData.addUriRecord("dataability:///com.example.myapplication1?user.txt");
- ```
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| uri | string | Yes | URI text. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+pasteData.addUriRecord("dataability:///com.example.myapplication1?user.txt");
+```
### addRecord7+
@@ -533,21 +554,22 @@ The pasteboard supports a maximum number of 128 data records.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | record | [PasteDataRecord](#pastedatarecord7) | Yes | Record to add. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| record | [PasteDataRecord](#pastedatarecord7) | Yes | Record to add. |
+
+**Example**
-- Example
-
- ```
- var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt");
- var textRecord = pasteboard.createPlainTextRecord("hello");
- var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
- var htmlRecord = pasteboard.createHtmlTextRecord(html);
- pasteData.addRecord(textRecord);
- pasteData.addRecord(htmlRecord);
- ```
+```js
+var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt");
+var textRecord = pasteboard.createPlainTextRecord("hello");
+var html = "\n" + "\n" + "\n" + "\n" + "HTML-PASTEBOARD_HTML\n" + "\n" + "\n" + " HEAD
\n" + " \n" + "\n" + "";
+var htmlRecord = pasteboard.createHtmlTextRecord(html);
+pasteData.addRecord(textRecord);
+pasteData.addRecord(htmlRecord);
+```
### getMimeTypes7+
@@ -558,17 +580,18 @@ Obtains **mimeTypes** in [PasteDataProperty](#pastedataproperty7) from this past
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | Array<string> | List of non-duplicate MIME types. |
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| Array<string> | List of non-duplicate MIME types. |
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var types = pasteData.getMimeTypes();
- ```
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var types = pasteData.getMimeTypes();
+```
### getPrimaryMimeType7+
@@ -579,17 +602,18 @@ Obtains the data type of the primary record.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | string | Data type of the primary record. |
+**Return value**
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var type = pasteData.getPrimaryMimeType();
- ```
+| Type | Description |
+| -------- | -------- |
+| string | Data type of the primary record. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var type = pasteData.getPrimaryMimeType();
+```
### getProperty7+
@@ -600,17 +624,18 @@ Obtains the property description object.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteDataProperty](#pastedataproperty7) | Property description object. |
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| [PasteDataProperty](#pastedataproperty7) | Property description object. |
+
+**Example**
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var property = pasteData.getProperty();
- ```
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var property = pasteData.getProperty();
+```
### getRecordAt7+
@@ -621,22 +646,24 @@ Obtains the record with the specified index.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | index | number | Yes | Index of the specified record. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| index | number | Yes | Index of the specified record. |
+
+**Return value**
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [PasteDataRecord](#pastedatarecord7) | Record with the specified index. |
+| Type | Description |
+| -------- | -------- |
+| [PasteDataRecord](#pastedatarecord7) | Record with the specified index. |
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var record = pasteData.getRecordAt(0);
- ```
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var record = pasteData.getRecordAt(0);
+```
### getRecordCount7+
@@ -647,17 +674,18 @@ Obtains the number of data records in this pasteboard.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | number | Number of records. |
+**Return value**
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var count = pasteData.getRecordCount();
- ```
+| Type | Description |
+| -------- | -------- |
+| number | Number of records. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var count = pasteData.getRecordCount();
+```
### getTag7+
@@ -668,17 +696,18 @@ Obtains the user-defined tag content. If the tag content is not set, null is ret
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | string | User-defined tag content if obtained and null if no tag is set. |
+**Return value**
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var tag = pasteData.getTag();
- ```
+| Type | Description |
+| -------- | -------- |
+| string | User-defined tag content if obtained and null if no tag is set. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var tag = pasteData.getTag();
+```
### hasMimeType7+
@@ -689,22 +718,24 @@ Checks whether the content of this pasteboard contains the specified data type.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | mimeType | string | Yes | Type of the data to query. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| mimeType | string | Yes | Type of the data to query. |
+
+**Return value**
-- Return values
- | Type | Description |
- | -------- | -------- |
- | boolean | Returns **true** if the specified data type exists; returns **false** otherwise. |
+| Type | Description |
+| -------- | -------- |
+| boolean | Returns **true** if the specified data type exists; returns **false** otherwise. |
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var hasType = pasteData.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN);
- ```
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var hasType = pasteData.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN);
+```
### removeRecordAt7+
@@ -715,22 +746,24 @@ Removes the data record with a specified index from this pasteboard.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | index | number | Yes | Specified index. |
+**Parameters**
-- Return values
- | Type | Description |
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| index | number | Yes | Specified index. |
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var isRemove = pasteData.removeRecordAt(0);
- ```
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var isRemove = pasteData.removeRecordAt(0);
+```
### replaceRecordAt7+
@@ -741,24 +774,26 @@ Replaces the data record with a specified index in this pasteboard.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | index | number | Yes | Specified index. |
- | record | [PasteDataRecord](#pastedatarecord7) | Yes | New record. |
+**Parameters**
-- Return values
- | Type | Description |
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| index | number | Yes | Specified index. |
+| record | [PasteDataRecord](#pastedatarecord7) | Yes | New record. |
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("hello");
- var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
- var isReplace = pasteData.replaceRecordAt(0, record);
- ```
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("hello");
+var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
+var isReplace = pasteData.replaceRecordAt(0, record);
+```
## pasteboard.getSystemPasteboard
@@ -769,21 +804,22 @@ Obtains the system pasteboard.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | [SystemPasteboard](#systempasteboard) | System pasteboard. |
+**Return value**
-- Example
-
- ```
- var systemPasteboard = pasteboard.getSystemPasteboard();
- ```
+| Type | Description |
+| -------- | -------- |
+| [SystemPasteboard](#systempasteboard) | System pasteboard. |
+
+**Example**
+
+```js
+var systemPasteboard = pasteboard.getSystemPasteboard();
+```
## SystemPasteboard
- Before calling any **SystemPasteboard** method, you must obtain a **SystemPasteboard** object using [getSystemPasteboard](#pasteboardgetsystempasteboard).
+Before calling any **SystemPasteboard** method, you must obtain a **SystemPasteboard** object using [getSystemPasteboard](#pasteboardgetsystempasteboard).
```
var systemPasteboard = pasteboard.getSystemPasteboard();
@@ -794,112 +830,117 @@ var systemPasteboard = pasteboard.getSystemPasteboard();
setPasteData(data:PasteData, callback:AsyncCallback<void>): void
-Writes data to a pasteboard. This method uses an asynchronous callback to return the result.
+Writes data to a pasteboard. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | data | [PasteData](#pastedata) | Yes | **PasteData** object. |
- | callback | AsyncCallback<void> | Yes | Callback used to return the data write result. |
-
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("content");
- var systemPasteboard = pasteboard.getSystemPasteboard();
- systemPasteboard.setPasteData(pasteData, (error, data) => {
- if (error) {
- console.error('Failed to setPasteData. Cause: ' + error.message);
- return;
- }
- console.info('setPasteData successfully.');
- });
- ```
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| data | [PasteData](#pastedata) | Yes | **PasteData** object. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the data write result. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("content");
+var systemPasteboard = pasteboard.getSystemPasteboard();
+systemPasteboard.setPasteData(pasteData, (error, data) => {
+ if (error) {
+ console.error('Failed to setPasteData. Cause: ' + error.message);
+ return;
+ }
+ console.info('setPasteData successfully.');
+});
+```
### setPasteData
setPasteData(data:PasteData): Promise<void>
-Writes data to a pasteboard. This method uses a promise to return the result.
+Writes data to a pasteboard. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Description |
- | -------- | -------- | -------- |
- | data | [PasteData](#pastedata) | **PasteData** object. |
-
-- Return values
- | Type | Description |
- | -------- | -------- |
- | Promise<void> | Promise used to return the data write result. |
-
-- Example
-
- ```
- var pasteData = pasteboard.createPlainTextData("content");
- var systemPasteboard = pasteboard.getSystemPasteboard();
- systemPasteboard.setPasteData(pasteData).then((data) => {
- console.info('setPasteData success.');
- }).catch((error) => {
- console.error('Failed to setPasteData. Cause: ' + error.message);
- });
- ```
+**Parameters**
+
+| Name | Type | Description |
+| -------- | -------- | -------- |
+| data | [PasteData](#pastedata) | **PasteData** object. |
+
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| Promise<void> | Promise used to return the data write result. |
+
+**Example**
+
+```js
+var pasteData = pasteboard.createPlainTextData("content");
+var systemPasteboard = pasteboard.getSystemPasteboard();
+systemPasteboard.setPasteData(pasteData).then((data) => {
+ console.info('setPasteData success.');
+}).catch((error) => {
+ console.error('Failed to setPasteData. Cause: ' + error.message);
+});
+```
### getPasteData
getPasteData( callback:AsyncCallback<PasteData>): void
-Reads the system pasteboard content. This method uses an asynchronous callback to return the result.
+Reads the system pasteboard content. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<[PasteData](#pastedata)> | Yes | Callback used to return the system pasteboard data. |
-
-- Example
-
- ```
- var systemPasteboard = pasteboard.getSystemPasteboard();
- systemPasteboard.getPasteData((error, pasteData) => {
- if (error) {
- console.error('Failed to getPasteData. Cause: ' + error.message);
- return;
- }
- var text = pasteData.getPrimaryText();
- });
- ```
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<[PasteData](#pastedata)> | Yes | Callback used to return the system pasteboard data. |
+
+**Example**
+
+```js
+var systemPasteboard = pasteboard.getSystemPasteboard();
+systemPasteboard.getPasteData((error, pasteData) => {
+ if (error) {
+ console.error('Failed to getPasteData. Cause: ' + error.message);
+ return;
+ }
+ var text = pasteData.getPrimaryText();
+});
+```
### getPasteData
getPasteData(): Promise<PasteData>
-Reads the system pasteboard content. This method uses a promise to return the result.
+Reads the system pasteboard content. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | Promise<[PasteData](#pastedata)> | Promise used to return the system pasteboard data. |
+**Return value**
-- Example
-
- ```
- var systemPasteboard = pasteboard.getSystemPasteboard();
- systemPasteboard.getPasteData().then((pasteData) => {
- var text = pasteData.getPrimaryText();
- }).catch((error) => {
- console.error('Failed to getPasteData. Cause: ' + error.message);
- })
- ```
+| Type | Description |
+| -------- | -------- |
+| Promise<[PasteData](#pastedata)> | Promise used to return the system pasteboard data. |
+
+**Example**
+
+```js
+var systemPasteboard = pasteboard.getSystemPasteboard();
+systemPasteboard.getPasteData().then((pasteData) => {
+ var text = pasteData.getPrimaryText();
+}).catch((error) => {
+ console.error('Failed to getPasteData. Cause: ' + error.message);
+})
+```
### on('update')7+
@@ -910,21 +951,22 @@ Subscribes to the content change event of the system pasteboard. If the pasteboa
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | type | string | Yes | Data type. The value **update** indicates the pasteboard content has changed. |
- | callback | function | Yes | Callback invoked when the pasteboard content changes. |
+**Parameters**
-- Example
-
- ```
- var systemPasteboard = pasteboard.getSystemPasteboard();
- var listener = ()=>{
- console.info('The system pasteboard has changed');
- };
- systemPasteboard.on('update', listener);
- ```
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| type | string | Yes | Data type. The value **update** indicates the pasteboard content has changed. |
+| callback | function | Yes | Callback invoked when the pasteboard content changes. |
+
+**Example**
+
+```js
+var systemPasteboard = pasteboard.getSystemPasteboard();
+var listener = ()=>{
+ console.info('The system pasteboard has changed');
+};
+systemPasteboard.on('update', listener);
+```
### off('update')7+
@@ -935,114 +977,119 @@ Unsubscribes from the system pasteboard content change event.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | type | string | Yes | Data type. The value **update** indicates the pasteboard content has changed. |
- | callback | function | No | Callback invoked when the pasteboard content changes. |
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| type | string | Yes | Data type. The value **update** indicates the pasteboard content has changed. |
+| callback | function | No | Callback invoked when the pasteboard content changes. |
-- Example
-
- ```
- systemPasteboard.off('update', listener);
- ```
+**Example**
+
+```js
+systemPasteboard.off('update', listener);
+```
### hasPasteData7+
hasPasteData(callback: AsyncCallback<boolean>): void
-Checks whether the system pasteboard contains content. This method uses an asynchronous callback to return the result.
+Checks whether the system pasteboard contains content. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<boolean> | Yes | Returns **true** if the pasteboard contains content; returns **false** otherwise. |
-
-- Example
-
- ```
- systemPasteboard.hasPasteData((err, data) => {
- if (err) {
- console.error('failed to hasPasteData because ' + JSON.stringify(err));
- return;
- }
- console.info('success hasPasteData : ' + JSON.stringify(data));
- });
- ```
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<boolean> | Yes | Returns **true** if the pasteboard contains content; returns **false** otherwise. |
+
+**Example**
+
+```js
+systemPasteboard.hasPasteData((err, data) => {
+ if (err) {
+ console.error('failed to hasPasteData because ' + JSON.stringify(err));
+ return;
+ }
+ console.info('success hasPasteData : ' + JSON.stringify(data));
+});
+```
### hasPasteData7+
hasPasteData(): Promise<boolean>
-Checks whether the system pasteboard contains content. This method uses a promise to return the result.
+Checks whether the system pasteboard contains content. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | Promise<boolean> | Returns **true** if the pasteboard contains content; returns **false** otherwise. |
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| Promise<boolean> | Returns **true** if the pasteboard contains content; returns **false** otherwise. |
+
+**Example**
-- Example
-
- ```
- systemPasteboard.hasPasteData().then((data) => {
- console.info('Operation succeeded. ' + JSON.stringify(data));
- }).catch((error) => {
- console.error('failed to hasPasteData because ' + JSON.stringify(error));
- });
- ```
+```js
+systemPasteboard.hasPasteData().then((data) => {
+ console.info('Operation succeeded. ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('failed to hasPasteData because ' + JSON.stringify(error));
+});
+```
### clear7+
clear(callback: AsyncCallback<void>): void
-Clears the system pasteboard content. This method uses an asynchronous callback to return the result.
+Clears the system pasteboard content. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Parameters
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<void> | Yes | Callback used to return the result. |
-
-- Example
-
- ```
- systemPasteboard.clear((err, data) => {
- if (err) {
- console.error('failed to clear because ' + JSON.stringify(err));
- return;
- }
- console.info('success clear');
- });
- ```
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+systemPasteboard.clear((err, data) => {
+ if (err) {
+ console.error('failed to clear because ' + JSON.stringify(err));
+ return;
+ }
+ console.info('success clear');
+});
+```
### clear7+
clear(): Promise<void>
-Clears the system pasteboard content. This method uses a promise to return the result.
+Clears the system pasteboard content. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.Pasteboard
-- Return values
- | Type | Description |
- | -------- | -------- |
- | Promise<void> | Promise used to return the result. |
-
-- Example
-
- ```
- systemPasteboard.clear().then((data) => {
- console.info('success clear');
- }).catch((error) => {
- console.error('failed to clear because ' + JSON.stringify(error));
- });
- ```
+**Return value**
+
+| Type | Description |
+| -------- | -------- |
+| Promise<void> | Promise used to return the result. |
+
+**Example**
+
+```js
+systemPasteboard.clear().then((data) => {
+ console.info('success clear');
+}).catch((error) => {
+ console.error('failed to clear because ' + JSON.stringify(error));
+});
+```
\ No newline at end of file