harmony 鸿蒙公共事件子系统ChangeLog

  • 2023-06-24
  • 浏览 (457)

公共事件子系统ChangeLog

cl.ces.1 ohos.commonEvent中Support事件枚举值修改。

变更影响

4.0.3.2之前使用ohos.commonEvent的下面的公共事件需要修改适配。

公共事件名
COMMON_EVENT_PACKAGE_CACHE_CLEARED
COMMON_EVENT_USB_STATE
COMMON_EVENT_USB_PORT_CHANGED
COMMON_EVENT_VOLUME_REMOVED
COMMON_EVENT_VOLUME_UNMOUNTED
COMMON_EVENT_VOLUME_MOUNTED
COMMON_EVENT_VOLUME_BAD_REMOVAL
COMMON_EVENT_VOLUME_EJECT
COMMON_EVENT_SLOT_CHANGE
COMMON_EVENT_SPN_INFO_CHANGED
COMMON_EVENT_QUICK_FIX_APPLY_RESULT

关键的接口/组件变更

下面修改的ohos.commonEvent中的公共事件替换到ohos.commonEventManager中。

模块 ohos.commonEvent ohos.commonEventManager
COMMON_EVENT_PACKAGE_CACHE_CLEARED COMMON_EVENT_PACKAGE_CACHE_CLEARED
COMMON_EVENT_USB_STATE COMMON_EVENT_USB_STATE
COMMON_EVENT_USB_PORT_CHANGED COMMON_EVENT_USB_PORT_CHANGED
COMMON_EVENT_VOLUME_REMOVED COMMON_EVENT_VOLUME_REMOVED
COMMON_EVENT_VOLUME_UNMOUNTED COMMON_EVENT_VOLUME_UNMOUNTED
事件名 COMMON_EVENT_VOLUME_MOUNTED COMMON_EVENT_VOLUME_MOUNTED
COMMON_EVENT_VOLUME_BAD_REMOVAL COMMON_EVENT_VOLUME_BAD_REMOVAL
COMMON_EVENT_VOLUME_EJECT COMMON_EVENT_VOLUME_EJECT
COMMON_EVENT_SLOT_CHANGE COMMON_EVENT_SLOT_CHANGE
COMMON_EVENT_SPN_INFO_CHANGED COMMON_EVENT_SPN_INFO_CHANGED
COMMON_EVENT_QUICK_FIX_APPLY_RESULT COMMON_EVENT_QUICK_FIX_APPLY_RESULT

适配指导

将调用ohos.commonEvent中的事件替换成调用@ohos.commonEventManager,比如以下示例代码:

import commonEvent from '@ohos.commonEvent';
let event: string = commonEvent.Support.COMMON_EVENT_PACKAGE_CACHE_CLEARED;

需要修改成

import commonEventManager from '@ohos.commonEventManager';
let event: string = commonEventManager.Support.COMMON_EVENT_PACKAGE_CACHE_CLEARED;

你可能感兴趣的鸿蒙文章

harmony 鸿蒙程序访问控制子系统ChangeLog

harmony 鸿蒙security子系统ChangeLog

harmony 鸿蒙软总线子系统ChangeLog

harmony 鸿蒙web子系统ChangeLog

harmony 鸿蒙帐号子系统ChangeLog

harmony 鸿蒙arkui子系统ChangeLog

harmony 鸿蒙包管理子系统ChangeLog

harmony 鸿蒙文件管理子系统ChangeLog

harmony 鸿蒙剪贴板子系统ChangeLog

harmony 鸿蒙电源子系统ChangeLog

0  赞