Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e3de1bd9
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
You need to sign in or sign up before continuing.
提交
e3de1bd9
编写于
3月 23, 2022
作者:
Z
zengyawen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update docs
Signed-off-by:
N
zengyawen
<
zengyawen1@huawei.com
>
上级
e8367d80
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
197 addition
and
200 deletion
+197
-200
zh-cn/application-dev/reference/apis/js-apis-data-rdb.md
zh-cn/application-dev/reference/apis/js-apis-data-rdb.md
+7
-5
zh-cn/application-dev/reference/apis/js-apis-pasteboard.md
zh-cn/application-dev/reference/apis/js-apis-pasteboard.md
+190
-195
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-data-rdb.md
浏览文件 @
e3de1bd9
...
@@ -1612,10 +1612,10 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array
...
@@ -1612,10 +1612,10 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array
**示例**
:
**示例**
:
```
```
let predicatesync = new rdb.RdbPredicates('EMPLOYEE')
let predicatesync = new
data_
rdb.RdbPredicates('EMPLOYEE')
predicatesync.inDevices(['12345678abcde'])
predicatesync.inDevices(['12345678abcde'])
let promisesync = rdbStore.sync(rdb.SyncMode.SYNC_MODE_PUSH, predicatesync)
let promisesync = rdbStore.sync(
data_
rdb.SyncMode.SYNC_MODE_PUSH, predicatesync)
promisesync.then((result) {
promisesync.then((result)
=>
{
console.log('sync done.')
console.log('sync done.')
for (let i = 0; i < result.length; i++) {
for (let i = 0; i < result.length; i++) {
console.log('device=' + result[i][0] + ' status=' + result[i][1])
console.log('device=' + result[i][0] + ' status=' + result[i][1])
...
@@ -1634,6 +1634,7 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<stri
...
@@ -1634,6 +1634,7 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<stri
**系统能力**
:SystemCapability.DistributedDataManager.RelationalStore.Core。
**系统能力**
:SystemCapability.DistributedDataManager.RelationalStore.Core。
**参数**
:
**参数**
:
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | SubscribeType | 是 | 指在{@code SubscribeType}中定义的订阅类型。 |
| type | SubscribeType | 是 | 指在{@code SubscribeType}中定义的订阅类型。 |
...
@@ -1647,7 +1648,7 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<stri
...
@@ -1647,7 +1648,7 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<stri
}
}
}
}
try {
try {
rdbStore.on('dataChange', rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver)
rdbStore.on('dataChange',
data_
rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver)
} catch (err) {
} catch (err) {
console.log('register observer failed')
console.log('register observer failed')
}
}
...
@@ -1662,6 +1663,7 @@ off(event:'dataChange', type: SubscribeType, observer: Callback<Array<stri
...
@@ -1662,6 +1663,7 @@ off(event:'dataChange', type: SubscribeType, observer: Callback<Array<stri
**系统能力**
:SystemCapability.DistributedDataManager.RelationalStore.Core。
**系统能力**
:SystemCapability.DistributedDataManager.RelationalStore.Core。
**参数**
:
**参数**
:
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | SubscribeType | 是 | 指在{@code SubscribeType}中定义的订阅类型。 |
| type | SubscribeType | 是 | 指在{@code SubscribeType}中定义的订阅类型。 |
...
@@ -1675,7 +1677,7 @@ off(event:'dataChange', type: SubscribeType, observer: Callback<Array<stri
...
@@ -1675,7 +1677,7 @@ off(event:'dataChange', type: SubscribeType, observer: Callback<Array<stri
}
}
}
}
try {
try {
rdbStore.off('dataChange', rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver)
rdbStore.off('dataChange',
data_
rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver)
} catch (err) {
} catch (err) {
console.log('unregister observer failed')
console.log('unregister observer failed')
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-pasteboard.md
浏览文件 @
e3de1bd9
...
@@ -34,17 +34,17 @@ createPlainTextData(text:string): PasteData
...
@@ -34,17 +34,17 @@ createPlainTextData(text:string): PasteData
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| text | string | 是 | 纯文本数据。 |
| text | string | 是 | 纯文本数据。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteData
](
#pastedata
)
| 包含此内容的剪贴板内容对象。 |
|
[
PasteData
](
#pastedata
)
| 包含此内容的剪贴板内容对象。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("content");
var pasteData = pasteboard.createPlainTextData("content");
...
@@ -59,17 +59,17 @@ createHtmlData(htmlText:string): PasteData
...
@@ -59,17 +59,17 @@ createHtmlData(htmlText:string): PasteData
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| htmlText | string | 是 | 待保存的HTML文本内容。 |
| htmlText | string | 是 | 待保存的HTML文本内容。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteData
](
#pastedata
)
| 包含此内容的剪贴板内容对象。 |
|
[
PasteData
](
#pastedata
)
| 包含此内容的剪贴板内容对象。 |
-
示例
**示例**
```
```
var html = "
<!DOCTYPE html>
\n" + "
<html>
\n" + "
<head>
\n" + "
<meta
charset=
\"utf-8\"
>
\n" + "
<title>
HTML-PASTEBOARD_HTML
</title>
\n" + "
</head>
\n" + "
<body>
\n" + "
<h1>
HEAD
</h1>
\n" + "
<p></p>
\n" + "
</body>
\n" + "
</html>
";
var html = "
<!DOCTYPE html>
\n" + "
<html>
\n" + "
<head>
\n" + "
<meta
charset=
\"utf-8\"
>
\n" + "
<title>
HTML-PASTEBOARD_HTML
</title>
\n" + "
</head>
\n" + "
<body>
\n" + "
<h1>
HEAD
</h1>
\n" + "
<p></p>
\n" + "
</body>
\n" + "
</html>
";
...
@@ -85,17 +85,17 @@ createWantData(want:Want): PasteData
...
@@ -85,17 +85,17 @@ createWantData(want:Want): PasteData
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-featureAbility.md#want
)
| 是 | 待保存的Want内容。 |
| want |
[
Want
](
js-apis-featureAbility.md#want
)
| 是 | 待保存的Want内容。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteData
](
#pastedata
)
| 包含此内容的剪贴板内容对象。 |
|
[
PasteData
](
#pastedata
)
| 包含此内容的剪贴板内容对象。 |
-
示例
**示例**
```
```
var object = {
var object = {
...
@@ -114,20 +114,20 @@ createUriData(uri:string): PasteData
...
@@ -114,20 +114,20 @@ createUriData(uri:string): PasteData
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | 待保存的URI内容。 |
| uri | string | 是 | 待保存的URI内容。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteData
](
#pastedata
)
| 包含此内容的剪贴板内容对象。 |
|
[
PasteData
](
#pastedata
)
| 包含此内容的剪贴板内容对象。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt");
var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt"
"
);
```
```
...
@@ -139,17 +139,17 @@ createPlainTextRecord(text:string): PasteDataRecord
...
@@ -139,17 +139,17 @@ createPlainTextRecord(text:string): PasteDataRecord
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| text | string | 是 | 纯文本内容。 |
| text | string | 是 | 纯文本内容。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 一条新建的纯文本内容条目。 |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 一条新建的纯文本内容条目。 |
-
示例
**示例**
```
```
var record = pasteboard.createPlainTextRecord("hello");
var record = pasteboard.createPlainTextRecord("hello");
...
@@ -164,17 +164,17 @@ createHtmlTextRecord(htmlText:string): PasteDataRecord
...
@@ -164,17 +164,17 @@ createHtmlTextRecord(htmlText:string): PasteDataRecord
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| htmlText | string | 是 | 文本内容。 |
| htmlText | string | 是 | 文本内容。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 一条新建的HTML内容条目。 |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 一条新建的HTML内容条目。 |
-
示例
**示例**
```
```
var html = "
<!DOCTYPE html>
\n" + "
<html>
\n" + "
<head>
\n" + "
<meta
charset=
\"utf-8\"
>
\n" + "
<title>
HTML-PASTEBOARD_HTML
</title>
\n" + "
</head>
\n" + "
<body>
\n" + "
<h1>
HEAD
</h1>
\n" + "
<p></p>
\n" + "
</body>
\n" + "
</html>
";
var html = "
<!DOCTYPE html>
\n" + "
<html>
\n" + "
<head>
\n" + "
<meta
charset=
\"utf-8\"
>
\n" + "
<title>
HTML-PASTEBOARD_HTML
</title>
\n" + "
</head>
\n" + "
<body>
\n" + "
<h1>
HEAD
</h1>
\n" + "
<p></p>
\n" + "
</body>
\n" + "
</html>
";
...
@@ -190,17 +190,17 @@ createWantRecord(want:Want): PasteDataRecord
...
@@ -190,17 +190,17 @@ createWantRecord(want:Want): PasteDataRecord
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-featureAbility.md#want
)
| 是 | Want类型数据。 |
| want |
[
Want
](
js-apis-featureAbility.md#want
)
| 是 | Want类型数据。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 一条新建的Want内容条目 |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 一条新建的Want内容条目 |
-
示例
**示例**
```
```
var object = {
var object = {
...
@@ -219,20 +219,20 @@ createUriRecord(uri:string): PasteDataRecord
...
@@ -219,20 +219,20 @@ createUriRecord(uri:string): PasteDataRecord
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | URI内容。 |
| uri | string | 是 | URI内容。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 一条新建的URI内容条目。 |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 一条新建的URI内容条目。 |
-
示例
**示例**
```
```
var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt"
"
);
```
```
...
@@ -277,15 +277,15 @@ convertToText(): Promise<string>
...
@@ -277,15 +277,15 @@ convertToText(): Promise<string>
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Promise
<
void
>
| 异步回调函数,调用成功则返回强制转换的文本内容,调用失败则返回error信息。 |
| Promise
<
void
>
| 异步回调函数,调用成功则返回强制转换的文本内容,调用失败则返回error信息。 |
-
示例
**示例**
```
```
var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt"
"
);
record.convertToText().then((data) => {
record.convertToText().then((data) => {
console.info('convertToText success data : ' + JSON.stringify(data));
console.info('convertToText success data : ' + JSON.stringify(data));
}).catch((error) => {
}).catch((error) => {
...
@@ -302,15 +302,15 @@ convertToText(callback: AsyncCallback<string>): void
...
@@ -302,15 +302,15 @@ convertToText(callback: AsyncCallback<string>): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
string
>
| 是 | 回调函数,调用成功则返回强制转换的文本内容,调用失败则返回error信息。 |
| callback | AsyncCallback
<
string
>
| 是 | 回调函数,调用成功则返回强制转换的文本内容,调用失败则返回error信息。 |
-
示例
**示例**
```
```
var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt"
"
);
record.convertToText((err, data) => {
record.convertToText((err, data) => {
if (err) {
if (err) {
console.error('convertToText failed because ' + JSON.stringify(err));
console.error('convertToText failed because ' + JSON.stringify(err));
...
@@ -336,20 +336,15 @@ getPrimaryText(): string
...
@@ -336,20 +336,15 @@ getPrimaryText(): string
获取首个条目的纯文本内容。
获取首个条目的纯文本内容。
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**返回值**
无
-
返回值
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| string | 纯文本内容。 |
| string | 纯文本内容。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -365,12 +360,12 @@ getPrimaryHtml(): string
...
@@ -365,12 +360,12 @@ getPrimaryHtml(): string
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| string | HTML文本数据。 |
| string | HTML文本数据。 |
-
示例
**示例**
```
```
var html = "
<!DOCTYPE html>
\n" + "
<html>
\n" + "
<head>
\n" + "
<meta
charset=
\"utf-8\"
>
\n" + "
<title>
HTML-PASTEBOARD_HTML
</title>
\n" + "
</head>
\n" + "
<body>
\n" + "
<h1>
HEAD
</h1>
\n" + "
<p></p>
\n" + "
</body>
\n" + "
</html>
";
var html = "
<!DOCTYPE html>
\n" + "
<html>
\n" + "
<head>
\n" + "
<meta
charset=
\"utf-8\"
>
\n" + "
<title>
HTML-PASTEBOARD_HTML
</title>
\n" + "
</head>
\n" + "
<body>
\n" + "
<h1>
HEAD
</h1>
\n" + "
<p></p>
\n" + "
</body>
\n" + "
</html>
";
...
@@ -387,12 +382,12 @@ getPrimaryWant(): Want
...
@@ -387,12 +382,12 @@ getPrimaryWant(): Want
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
Want
](
js-apis-featureAbility.md#want
)
| Want对象内容。 |
|
[
Want
](
js-apis-featureAbility.md#want
)
| Want对象内容。 |
-
示例
**示例**
```
```
var object = {
var object = {
...
@@ -412,15 +407,15 @@ getPrimaryUri(): string
...
@@ -412,15 +407,15 @@ getPrimaryUri(): string
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| string | URI文本内容。 |
| string | URI文本内容。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt);
var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt
"
);
var uri = pasteData.getPrimaryUri();
var uri = pasteData.getPrimaryUri();
```
```
...
@@ -435,12 +430,12 @@ addTextRecord(text: string): void
...
@@ -435,12 +430,12 @@ addTextRecord(text: string): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| text | string | 是 | 纯文本内容。 |
| text | string | 是 | 纯文本内容。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -458,12 +453,12 @@ addHtmlRecord(htmlText: string): void
...
@@ -458,12 +453,12 @@ addHtmlRecord(htmlText: string): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| htmlText | string | 是 | HTML格式的文本内容。 |
| htmlText | string | 是 | HTML格式的文本内容。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -482,12 +477,12 @@ addWantRecord(want: Want): void
...
@@ -482,12 +477,12 @@ addWantRecord(want: Want): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-featureAbility.md#want
)
| 是 | Want对象内容。 |
| want |
[
Want
](
js-apis-featureAbility.md#want
)
| 是 | Want对象内容。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -509,16 +504,16 @@ addUriRecord(uri: string): void
...
@@ -509,16 +504,16 @@ addUriRecord(uri: string): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | URI文本内容。 |
| uri | string | 是 | URI文本内容。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
pasteData.addUriRecord("dataability:///com.example.myapplication1?user.txt");
pasteData.addUriRecord("dataability:///com.example.myapplication1?user.txt"
"
);
```
```
...
@@ -532,15 +527,15 @@ addRecord(record: PasteDataRecord): void
...
@@ -532,15 +527,15 @@ addRecord(record: PasteDataRecord): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| record |
[
PasteDataRecord
](
#pastedatarecord7
)
| 是 | 待添加的条目。 |
| record |
[
PasteDataRecord
](
#pastedatarecord7
)
| 是 | 待添加的条目。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt");
var pasteData = pasteboard.createUriData("dataability:///com.example.myapplication1?user.txt"
"
);
var textRecord = pasteboard.createPlainTextRecord("hello");
var textRecord = pasteboard.createPlainTextRecord("hello");
var html = "
<!DOCTYPE html>
\n" + "
<html>
\n" + "
<head>
\n" + "
<meta
charset=
\"utf-8\"
>
\n" + "
<title>
HTML-PASTEBOARD_HTML
</title>
\n" + "
</head>
\n" + "
<body>
\n" + "
<h1>
HEAD
</h1>
\n" + "
<p></p>
\n" + "
</body>
\n" + "
</html>
";
var html = "
<!DOCTYPE html>
\n" + "
<html>
\n" + "
<head>
\n" + "
<meta
charset=
\"utf-8\"
>
\n" + "
<title>
HTML-PASTEBOARD_HTML
</title>
\n" + "
</head>
\n" + "
<body>
\n" + "
<h1>
HEAD
</h1>
\n" + "
<p></p>
\n" + "
</body>
\n" + "
</html>
";
var htmlRecord = pasteboard.createHtmlTextRecord(html);
var htmlRecord = pasteboard.createHtmlTextRecord(html);
...
@@ -557,12 +552,12 @@ getMimeTypes(): Array<string>
...
@@ -557,12 +552,12 @@ getMimeTypes(): Array<string>
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Array
<
string
>
| 非重复的类型列表。 |
| Array
<
string
>
| 非重复的类型列表。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -578,12 +573,12 @@ getPrimaryMimeType(): string
...
@@ -578,12 +573,12 @@ getPrimaryMimeType(): string
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| string | 首个条目的数据类型。 |
| string | 首个条目的数据类型。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -599,12 +594,12 @@ getProperty(): PasteDataProperty
...
@@ -599,12 +594,12 @@ getProperty(): PasteDataProperty
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteDataProperty
](
#pastedataproperty7
)
| 属性描述对象。 |
|
[
PasteDataProperty
](
#pastedataproperty7
)
| 属性描述对象。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -620,17 +615,17 @@ getRecordAt(index: number): PasteDataRecord
...
@@ -620,17 +615,17 @@ getRecordAt(index: number): PasteDataRecord
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| index | number | 是 | 指定条目的下标。 |
| index | number | 是 | 指定条目的下标。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 指定下标的条目。 |
|
[
PasteDataRecord
](
#pastedatarecord7
)
| 指定下标的条目。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -646,12 +641,12 @@ getRecordCount(): number
...
@@ -646,12 +641,12 @@ getRecordCount(): number
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| number | 条目的个数。 |
| number | 条目的个数。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -667,12 +662,12 @@ getTag(): string
...
@@ -667,12 +662,12 @@ getTag(): string
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| string | 获取用户自定义的标签内容,如果没有设置用户自定义的标签内容将返回空。 |
| string | 获取用户自定义的标签内容,如果没有设置用户自定义的标签内容将返回空。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -688,17 +683,17 @@ hasMimeType(mimeType: string): boolean
...
@@ -688,17 +683,17 @@ hasMimeType(mimeType: string): boolean
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| mimeType | string | 是 | 待查询的数据类型。 |
| mimeType | string | 是 | 待查询的数据类型。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| boolean | 有指定的数据类型返回true,否则返回false。 |
| boolean | 有指定的数据类型返回true,否则返回false。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -714,17 +709,17 @@ removeRecordAt(index: number): boolean
...
@@ -714,17 +709,17 @@ removeRecordAt(index: number): boolean
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| index | number | 是 | 指定的下标。 |
| index | number | 是 | 指定的下标。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| boolean | 成功移除返回true,失败返回false。 |
| boolean | 成功移除返回true,失败返回false。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
...
@@ -740,22 +735,22 @@ replaceRecordAt(index: number, record: PasteDataRecord): boolean
...
@@ -740,22 +735,22 @@ replaceRecordAt(index: number, record: PasteDataRecord): boolean
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| index | number | 是 | 指定的下标。 |
| index | number | 是 | 指定的下标。 |
| record |
[
PasteDataRecord
](
#pastedatarecord7
)
| 是 | 替换后的条目。 |
| record |
[
PasteDataRecord
](
#pastedatarecord7
)
| 是 | 替换后的条目。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| boolean | 成功替换返回true,失败返回false。 |
| boolean | 成功替换返回true,失败返回false。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("hello");
var pasteData = pasteboard.createPlainTextData("hello");
var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt");
var record = pasteboard.createUriRecord("dataability:///com.example.myapplication1?user.txt"
"
);
var isReplace = pasteData.replaceRecordAt(0, record);
var isReplace = pasteData.replaceRecordAt(0, record);
```
```
...
@@ -768,12 +763,12 @@ getSystemPasteboard(): SystemPasteboard
...
@@ -768,12 +763,12 @@ getSystemPasteboard(): SystemPasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
|
[
SystemPasteboard
](
#systempasteboard
)
| 系统剪切板对象。 |
|
[
SystemPasteboard
](
#systempasteboard
)
| 系统剪切板对象。 |
-
示例
**示例**
```
```
var systemPasteboard = pasteboard.getSystemPasteboard();
var systemPasteboard = pasteboard.getSystemPasteboard();
...
@@ -797,13 +792,13 @@ setPasteData(pasteData:PasteData, callback:AsyncCallback<void>): void
...
@@ -797,13 +792,13 @@ setPasteData(pasteData:PasteData, callback:AsyncCallback<void>): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pasteData |
[
PasteData
](
#pastedata
)
| 是 | PasteData对象。 |
| pasteData |
[
PasteData
](
#pastedata
)
| 是 | PasteData对象。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数,表示是否成功将数据写入系统剪切板。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数,表示是否成功将数据写入系统剪切板。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("content");
var pasteData = pasteboard.createPlainTextData("content");
...
@@ -826,17 +821,17 @@ setPasteData(pasteData:PasteData): Promise<void>
...
@@ -826,17 +821,17 @@ setPasteData(pasteData:PasteData): Promise<void>
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 说明 |
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| -------- | -------- | -------- |
| pasteData |
[
PasteData
](
#pastedata
)
| PasteData对象。 |
| pasteData |
[
PasteData
](
#pastedata
)
| PasteData对象。 |
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Promise
<
void
>
| 异步回调函数,表示是否成功将数据写入系统剪切板。 |
| Promise
<
void
>
| 异步回调函数,表示是否成功将数据写入系统剪切板。 |
-
示例
**示例**
```
```
var pasteData = pasteboard.createPlainTextData("content");
var pasteData = pasteboard.createPlainTextData("content");
...
@@ -857,12 +852,12 @@ getPasteData( callback:AsyncCallback<PasteData>): void
...
@@ -857,12 +852,12 @@ getPasteData( callback:AsyncCallback<PasteData>): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
[PasteData](#pastedata)
>
| 是 | 回调函数,返回系统剪切板数据。 |
| callback | AsyncCallback
<
[PasteData](#pastedata)
>
| 是 | 回调函数,返回系统剪切板数据。 |
-
示例
**示例**
```
```
var systemPasteboard = pasteboard.getSystemPasteboard();
var systemPasteboard = pasteboard.getSystemPasteboard();
...
@@ -884,12 +879,12 @@ getPasteData(): Promise<PasteData>
...
@@ -884,12 +879,12 @@ getPasteData(): Promise<PasteData>
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Promise
<
[PasteData](#pastedata)
>
| 异步回调函数,调返回系统剪切板数据。 |
| Promise
<
[PasteData](#pastedata)
>
| 异步回调函数,调返回系统剪切板数据。 |
-
示例
**示例**
```
```
var systemPasteboard = pasteboard.getSystemPasteboard();
var systemPasteboard = pasteboard.getSystemPasteboard();
...
@@ -909,13 +904,13 @@ on(type: 'update', callback: () =>void ): void
...
@@ -909,13 +904,13 @@ on(type: 'update', callback: () =>void ): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 取值为'update',表示系统剪贴板内容变化事件。 |
| type | string | 是 | 取值为'update',表示系统剪贴板内容变化事件。 |
| callback | function | 是 | 剪贴板中内容变化时触发的用户程序的回调。 |
| callback | function | 是 | 剪贴板中内容变化时触发的用户程序的回调。 |
-
示例
**示例**
```
```
var systemPasteboard = pasteboard.getSystemPasteboard();
var systemPasteboard = pasteboard.getSystemPasteboard();
...
@@ -934,13 +929,13 @@ off(type: 'update', callback?: () =>void ): void
...
@@ -934,13 +929,13 @@ off(type: 'update', callback?: () =>void ): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 取值为'update',表示系统剪贴板内容变化事件。 |
| type | string | 是 | 取值为'update',表示系统剪贴板内容变化事件。 |
| callback | function | 否 | 剪贴板中内容变化时触发的用户程序的回调。 |
| callback | function | 否 | 剪贴板中内容变化时触发的用户程序的回调。 |
-
示例
**示例**
```
```
systemPasteboard.off('update', listener);
systemPasteboard.off('update', listener);
...
@@ -955,12 +950,12 @@ hasPasteData(callback: AsyncCallback<boolean>): void
...
@@ -955,12 +950,12 @@ hasPasteData(callback: AsyncCallback<boolean>): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
boolean
>
| 是 | 返回为true表示系统剪切板中有内容,返回false表示系统剪切板中没有内容。 |
| callback | AsyncCallback
<
boolean
>
| 是 | 返回为true表示系统剪切板中有内容,返回false表示系统剪切板中没有内容。 |
-
示例
**示例**
```
```
systemPasteboard.hasPasteData((err, data) => {
systemPasteboard.hasPasteData((err, data) => {
...
@@ -981,12 +976,12 @@ hasPasteData(): Promise<boolean>
...
@@ -981,12 +976,12 @@ hasPasteData(): Promise<boolean>
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Promise
<
boolean
>
| 返回为true表示系统剪切板中有内容,返回false表示系统剪切板中没有内容。 |
| Promise
<
boolean
>
| 返回为true表示系统剪切板中有内容,返回false表示系统剪切板中没有内容。 |
-
示例
**示例**
```
```
systemPasteboard.hasPasteData().then((data) => {
systemPasteboard.hasPasteData().then((data) => {
...
@@ -1005,12 +1000,12 @@ clear(callback: AsyncCallback<void>): void
...
@@ -1005,12 +1000,12 @@ clear(callback: AsyncCallback<void>): void
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
参数
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数,表示是否成功清空系统剪切板内容。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数,表示是否成功清空系统剪切板内容。 |
-
示例
**示例**
```
```
systemPasteboard.clear((err, data) => {
systemPasteboard.clear((err, data) => {
...
@@ -1031,12 +1026,12 @@ clear(): Promise<void>
...
@@ -1031,12 +1026,12 @@ clear(): Promise<void>
**系统能力**
: SystemCapability.Miscservices.Pasteboard
**系统能力**
: SystemCapability.Miscservices.Pasteboard
-
返回值
**返回值**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| -------- | -------- |
| Promise
<
void
>
| 异步回调函数,表示是否成功清空系统剪切板内容。 |
| Promise
<
void
>
| 异步回调函数,表示是否成功清空系统剪切板内容。 |
-
示例
**示例**
```
```
systemPasteboard.clear().then((data) => {
systemPasteboard.clear().then((data) => {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录