• Home
Name Date Size #Lines LOC

..--

figures/12-May-2024-

frameworks/12-May-2024-11,3027,055

interfaces/12-May-2024-2,9521,117

test/12-May-2024-7,7334,742

LICENSED12-May-202410.1 KiB177150

OAT.xmlD12-May-20244 KiB7016

README_en.mdD12-May-2024956 3725

README_zh.mdD12-May-20242.3 KiB5733

bundle.jsonD12-May-20242.8 KiB8380

eventhandler.gniD12-May-20241.1 KiB2623

README_en.md

1# eventhandler
2
3#### Description
4{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
5
6#### Software Architecture
7Software architecture description
8
9#### Installation
10
111.  xxxx
122.  xxxx
133.  xxxx
14
15#### Instructions
16
171.  xxxx
182.  xxxx
193.  xxxx
20
21#### Contribution
22
231.  Fork the repository
242.  Create Feat_xxx branch
253.  Commit your code
264.  Create Pull Request
27
28
29#### Gitee Feature
30
311.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
322.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
333.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
344.  The most valuable open source project [GVP](https://gitee.com/gvp)
355.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
366.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
37

README_zh.md

1# Eventhandler部件
2
3## 简介
4​        EventHandler提供了OpenHarmony线程间通信的基本能力,可以通过EventRunner创建新线程,将耗时的操作抛到新线程上执行,从而实现在不阻塞原来的线程的基础上合理地处理耗时任务。
5
6​        EventHandler主要包括如下核心类:
7
8| 类           | 功能介绍                                                     |
9| ------------ | ------------------------------------------------------------ |
10| EventRunner  | 消息队列的循环分发器,每个线程只有一个EventRunner,主要用于管理消息队列EventQueue,不断地从队列中取出InnerEvent分发至对应的EventHandler处理。 |
11| InnerEvent   | 线程之间消息传递的实体封装,EventHandler接收与处理的消息对象。EventHandler待处理的InnerEvent的优先级可在IMMEDIATE、HIGH、LOW、IDLE中选择,并设置合适的delayTime。 |
12| EventHandler | 发送和处理消息的核心类,通过绑定一个EventRunner实现对消息队列进行循环分发的功能。 |
13| EventQueue   | 线程消息队列,管理InnerEvent,在初始化EventRunner对象时需要创建一个与之关联的EventQueue。 |
14
15
16### 架构图
17
18**图1** 子系统架构图
19
20![evenhandler](figures/evenhandler.png)
21
22
23
24## 目录
25
26```
27base/notification/eventhandler
28├── interfaces
29│   ├── inner_api                      # 内部接口存放目录
30│   └── kits                           # 外部接口存放目录
31│       └── native                     # C/C++接口
32├── frameworks                         # 包管理服务框架代码
33│   ├── eventhandler                   # 内部实现存放目录
34│   ├── napi                           # js接口实现存放目录
35│   └── native                         # C/C++接口实现存放目录
36└── test                               # 测试目录
37```
38
39
40
41## 编译构建
42
43 ./build.sh --product-name xxxx --build-target eventhandler
44
45
46
47## 接口说明
48
49详见[API接口说明文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-emitter.md)50
51
52
53## 相关仓
54
55[HiTrace组件](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/README_zh.md)
56
57[HiChecker组件](https://gitee.com/openharmony/hiviewdfx_hichecker/blob/master/README_zh.md)