未验证 提交 4d00b634 编写于 作者: 葛亚芳 提交者: Gitee

update zh-cn/application-dev/reference/apis/js-apis-pasteboard.md.

Signed-off-by: N葛亚芳 <geyafang@huawei.com>
上级 3cc29fda
...@@ -636,8 +636,8 @@ let opt = { ...@@ -636,8 +636,8 @@ let opt = {
scaleMode: 1 scaleMode: 1
}; };
image.createPixelMap(buffer, opt).then((pixelMap) => { image.createPixelMap(buffer, opt).then((pixelMap) => {
let pasteData = pasteboard.createPixelMapData(pixelMap); let pasteData = pasteboard.createData('app/xml',pixelMap);
let pixelMap = pasteData.getPrimaryPixelMap(); let PixelMap = pasteData.getPrimaryPixelMap();
}); });
``` ```
...@@ -1226,6 +1226,7 @@ off(type: 'update', callback?: () =&gt;void ): void ...@@ -1226,6 +1226,7 @@ off(type: 'update', callback?: () =&gt;void ): void
**示例:** **示例:**
```js ```js
let systemPasteboard = pasteboard.getSystemPasteboard();
let listener = () => { let listener = () => {
console.info('The system pasteboard has changed.'); console.info('The system pasteboard has changed.');
}; };
...@@ -1249,6 +1250,7 @@ clearData(callback: AsyncCallback&lt;void&gt;): void ...@@ -1249,6 +1250,7 @@ clearData(callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
```js ```js
let systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clearData((err, data) => { systemPasteboard.clearData((err, data) => {
if (err) { if (err) {
console.error(`Failed to clear the pasteboard. Cause: ${err.message}`); console.error(`Failed to clear the pasteboard. Cause: ${err.message}`);
...@@ -1275,6 +1277,7 @@ clearData(): Promise&lt;void&gt; ...@@ -1275,6 +1277,7 @@ clearData(): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
let systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clearData().then((data) => { systemPasteboard.clearData().then((data) => {
console.info('Succeeded in clearing the pasteboard.'); console.info('Succeeded in clearing the pasteboard.');
}).catch((err) => { }).catch((err) => {
...@@ -1442,6 +1445,7 @@ hasData(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -1442,6 +1445,7 @@ hasData(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
let systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.hasData((err, data) => { systemPasteboard.hasData((err, data) => {
if (err) { if (err) {
console.error(`Failed to check the PasteData. Cause: ${err.message}`); console.error(`Failed to check the PasteData. Cause: ${err.message}`);
...@@ -1468,6 +1472,7 @@ hasData(): Promise&lt;boolean&gt; ...@@ -1468,6 +1472,7 @@ hasData(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
let systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.hasData().then((data) => { systemPasteboard.hasData().then((data) => {
console.info(`Succeeded in checking the PasteData. Data: ${data}`); console.info(`Succeeded in checking the PasteData. Data: ${data}`);
}).catch((err) => { }).catch((err) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册