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