From b81d708d8f06b6b826d567130a6d9f7cfd4722d7 Mon Sep 17 00:00:00 2001 From: xuzhihao Date: Tue, 14 Mar 2023 13:44:01 +0800 Subject: [PATCH] Feature: fix err code of commonEvent Signed-off-by: xuzhihao --- zh-cn/application-dev/reference/apis/js-apis-commonEvent.md | 3 ++- .../reference/apis/js-apis-commonEventManager.md | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md index e7205cb1ae..cac5176ad0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md @@ -299,11 +299,12 @@ function subscribeCB(err, data) { } // 创建订阅者回调 -function createCB(err, subscriber) { +function createCB(err, commonEventSubscriber) { if (err.code) { console.error(`createSubscriber failed, code is ${err.code}`); } else { console.info("createSubscriber"); + subscriber = commonEventSubscriber; // 订阅公共事件 CommonEvent.subscribe(subscriber, subscribeCB); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md index ca44566e18..320fddb51d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md @@ -335,9 +335,10 @@ function SubscribeCB(err, data) { } //创建订阅者回调 -function createCB(err, subscriber) { +function createCB(err, commonEventSubscriber) { if(!err) { console.info("createSubscriber"); + subscriber = commonEventSubscriber; //订阅公共事件 try { CommonEventManager.subscribe(subscriber, SubscribeCB); @@ -391,11 +392,12 @@ function subscribeCB(err, data) { } } //创建订阅者回调 -function createCB(err, subscriber) { +function createCB(err, commonEventSubscriber) { if (err) { console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`); } else { console.info("createSubscriber"); + subscriber = commonEventSubscriber; //订阅公共事件 try { CommonEventManager.subscribe(subscriber, subscribeCB); -- GitLab