From f5fa6af4e2abc866a42f478b79216a4e1cc69845 Mon Sep 17 00:00:00 2001 From: lyj_love_code Date: Wed, 28 Sep 2022 14:18:54 +0800 Subject: [PATCH] fix the example code Signed-off-by: lyj_love_code --- .../application-dev/dfx/hiappevent-guidelines.md | 8 ++++---- .../reference/apis/js-apis-hiappevent.md | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/zh-cn/application-dev/dfx/hiappevent-guidelines.md b/zh-cn/application-dev/dfx/hiappevent-guidelines.md index 79b5bcc0e1..cdecfcafbb 100644 --- a/zh-cn/application-dev/dfx/hiappevent-guidelines.md +++ b/zh-cn/application-dev/dfx/hiappevent-guidelines.md @@ -120,12 +120,12 @@ // 根据设置阈值大小去获取订阅事件包(返回的事件包对象为null,表示当前订阅数据被全部取出) while ((eventPkg = holder.takeNext()) != null) { // 对获取的订阅事件包进行解析,并将解析结果打印在Log界面 - console.info('HiAppEvent eventPkg.packageId=' + eventPkg.packageId); - console.info('HiAppEvent eventPkg.row=' + eventPkg.row); - console.info('HiAppEvent eventPkg.size=' + eventPkg.size); + console.info(`HiAppEvent eventPkg.packageId=${eventPkg.packageId}`); + console.info(`HiAppEvent eventPkg.row=${eventPkg.row}`); + console.info(`HiAppEvent eventPkg.size=${eventPkg.size}`); // 对订阅事件包中的事件字符串数组进行遍历解析 for (const eventInfo of eventPkg.data) { - console.info('HiAppEvent eventPkg.data=' + eventInfo); + console.info(`HiAppEvent eventPkg.data=${eventInfo}`); } } } diff --git a/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md b/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md index cac05ccd42..64bcef93db 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md @@ -306,11 +306,11 @@ hiAppEvent.addWatcher({ } let eventPkg = null; while ((eventPkg = holder.takeNext()) != null) { - console.info("eventPkg.packageId=" + eventPkg.packageId); - console.info("eventPkg.row=" + eventPkg.row); - console.info("eventPkg.size=" + eventPkg.size); + console.info(`eventPkg.packageId=${eventPkg.packageId}`); + console.info(`eventPkg.row=${eventPkg.row}`); + console.info(`eventPkg.size=${eventPkg.size}`); for (const eventInfo of eventPkg.data) { - console.info("eventPkg.data=" + eventInfo); + console.info(`eventPkg.data=${eventInfo}`); } } } @@ -323,11 +323,11 @@ let holder = hiAppEvent.addWatcher({ if (holder != null) { let eventPkg = null; while ((eventPkg = holder.takeNext()) != null) { - console.info("eventPkg.packageId=" + eventPkg.packageId); - console.info("eventPkg.row=" + eventPkg.row); - console.info("eventPkg.size=" + eventPkg.size); + console.info(`eventPkg.packageId=${eventPkg.packageId}`); + console.info(`eventPkg.row=${eventPkg.row}`); + console.info(`eventPkg.size=${eventPkg.size}`); for (const eventInfo of eventPkg.data) { - console.info("eventPkg.data=" + eventInfo); + console.info(`eventPkg.data=${eventInfo}`); } } } -- GitLab