未验证 提交 a944651c 编写于 作者: O openharmony_ci 提交者: Gitee

!7963 翻译完成 7720:/notification/common-event.md. 修改代码缩进

Merge pull request !7963 from ester.zhou/TR-7720
...@@ -98,11 +98,11 @@ import commonEvent from '@ohos.commonEvent'; ...@@ -98,11 +98,11 @@ import commonEvent from '@ohos.commonEvent';
```js ```js
// Publish a common event. // Publish a common event.
commonEvent.publish("event", (err) => { commonEvent.publish("event", (err) => {
if (err.code) { if (err.code) {
console.error("[CommonEvent]PublishCallBack err=" + JSON.stringify(err)) console.error("[CommonEvent]PublishCallBack err=" + JSON.stringify(err))
} else { } else {
console.info("[CommonEvent]Publish1") console.info("[CommonEvent]Publish1")
} }
}) })
``` ```
...@@ -118,8 +118,8 @@ import commonEvent from '@ohos.commonEvent' ...@@ -118,8 +118,8 @@ import commonEvent from '@ohos.commonEvent'
```js ```js
// Attributes of a common event. // Attributes of a common event.
var options = { var options = {
code: 1, // Result code of the common event code: 1, // Result code of the common event
data: "initial data";// Result data of the common event data: "initial data",// Result data of the common event
} }
``` ```
...@@ -128,11 +128,11 @@ var options = { ...@@ -128,11 +128,11 @@ var options = {
```js ```js
// Publish a common event. // Publish a common event.
commonEvent.publish("event", options, (err) => { commonEvent.publish("event", options, (err) => {
if (err.code) { if (err.code) {
console.error("[CommonEvent]PublishCallBack err=" + JSON.stringify(err)) console.error("[CommonEvent]PublishCallBack err=" + JSON.stringify(err))
} else { } else {
console.info("[CommonEvent]Publish2") console.info("[CommonEvent]Publish2")
} }
}) })
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册