openharmony 鸿蒙 js-apis-inner-commonEvent-commonEventPublishData

2025-06-12 浏览 (1)

CommonEventPublishData

The CommonEventPublishData module provides APIs for defining common event content and attributes.

NOTE

The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.

If there is no restriction, any application can subscribe to common events and read related information. In this case, sensitive information should not be carried in common events. The subscriberPermissions and bundleName parameters of this module can be used to restrict the receiving scope of common events.

Attributes

System capability: SystemCapability.Notification.CommonEvent

NameTypeRead OnlyOptionalDescription
bundleNamestringNoYesBundle name of the subscriber that can receive the common event.
Atomic service API: This API can be used in atomic services since API version 11.
codenumberNoYesCommon event data transferred by the publisher. The default value is 0.
Atomic service API: This API can be used in atomic services since API version 11.
datastringNoYesCommon event data transferred by the publisher. The data size cannot exceed 64 KB.
Atomic service API: This API can be used in atomic services since API version 11.
subscriberPermissionsArray<string>NoYesPermissions required for subscribers to receive the common event.
Atomic service API: This API can be used in atomic services since API version 11.
isOrderedbooleanNoYesWhether the common event is an ordered one.
isStickybooleanNoYesWhether the common event is a sticky one. Only system applications and system services are allowed to send sticky events.
Required Permissions: ohos.permission.COMMONEVENT_STICKY
parameters{[key: string]: any}NoYesAdditional information about the common event transferred by the publisher.
Atomic service API: This API can be used in atomic services since API version 11.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Basic Services Kit

harmony 鸿蒙DeviceInfo

harmony 鸿蒙InitSync

harmony 鸿蒙OH_Print

harmony 鸿蒙OsAccount

harmony 鸿蒙Pasteboard

harmony 鸿蒙Print_Margin

harmony 鸿蒙Print_PageSize

harmony 鸿蒙Print_PrintAttributes

harmony 鸿蒙Print_PrintDocCallback

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/93eROq