提交 0b468a56 编写于 作者: E ester.zhou

update common-event.md (7720)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 73487125
......@@ -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.
先完成此消息的编辑!
想要评论请 注册