#打卡不停更#HarmonyOS应用API-CommonEvent.publish

鸿蒙时代
发布于 2022-10-27 14:43
6230浏览
0收藏

Api: CommonEvent.publish

版本适配:Api7

作用:发布公共事件

示例代码:

//发布公共事件回调
function PublishCallBack(err) {
    if (err.code) {
        console.error("publish failed " + JSON.stringify(err));
    } else {
        console.info("publish");
    }
}

//发布公共事件
CommonEvent.publish("event", PublishCallBack);

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.

标签
HarmonyOS应用API-CommonEvent.publish.docx 16.55K 10次下载
收藏
回复
举报
回复
    相关推荐