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

!7720 【轻量级 PR】:【OpenHarmony开源贡献者计划2022】/notification/common-event.md. 修改代码缩进

Merge pull request !7720 from fengli1111111/N/A
......@@ -98,11 +98,11 @@ import commonEvent from '@ohos.commonEvent';
```js
//发布公共事件
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
//公共事件相关信息
var options = {
code: 1, //公共事件的初始代码
data: "initial data",//公共事件的初始数据
code: 1, //公共事件的初始代码
data: "initial data",//公共事件的初始数据
}
```
......@@ -128,11 +128,11 @@ var options = {
```js
//发布公共事件
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.
先完成此消息的编辑!
想要评论请 注册