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