diff --git a/zh-cn/application-dev/dfx/hiappevent-guidelines.md b/zh-cn/application-dev/dfx/hiappevent-guidelines.md index 79b5bcc0e1e5e8f7bb91275cb7788c30d4bab895..cdecfcafbb0a94aaf26271a49abd3dabd0908a83 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 cac05ccd428ecbbeffe454bbdd5a94a120de2913..64bcef93dbd8f297263d84e1f00c7278c0b68430 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}`); } } }