README.md
1# eTS Common Event
2
3
4
5### Introduction
6
7This sample shows how to use **CommonEvent** APIs in Extended TypeScript (eTS) to create subscribers and subscribe to, publish, and unsubscribe from common events.
8
9### Usage
10
111. On the home screen of the sample app, touch **Create subscriber** and **Subscribe**. The execution result is displayed in the lower text box. Touch **Publish common event** and **Publish specified common event**. The common event information received after the common event is successfully published is displayed in the lower text box. Touch **Unsubscribe** to unsubscribe from the common event.
12
13
14
15### Constraints
16
17This sample can only be run on standard-system devices.
18
README_zh.md
1# 订阅公共事件
2
3### 简介
4
5本示例展示了在eTS中如何使用CommonEvent的接口完成创建订阅者、订阅公共事件、发布公共事件、取消订阅的功能。实现效果如下:
6
7
8
9### 相关概念
10
11CommonEvent:每个应用都可以订阅自己感兴趣的公共事件,订阅成功后且公共事件发布后,系统会把其发送给应用。这些公共事件可能来自系统、其他应用和应用自身。OpenHarmony提供了一套完整的API,支持用户订阅、发布和接收公共事件。
12
13### 相关权限
14
15不涉及。
16
17### 使用说明
18
191.页面中先点击**创建订阅者**、**订阅公共事件**,下方编辑框中显示执行结果;然后点击**发布公共事件**和**发布公共事件指定发布信息**,下方编辑框中展示公共事件发布成功后接收到的公共事件信息,点击**取消订阅**可以取消公共事件订阅。
20
21### 约束与限制
22
231.本示例仅支持标准系统上运行。
24
252.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。