diff --git a/README_en.md b/README_en.md new file mode 100644 index 0000000000000000000000000000000000000000..0b4658819b5704c95dfc63ffadc1cbbef57b389f --- /dev/null +++ b/README_en.md @@ -0,0 +1,36 @@ +# eventhandler + +#### Description +{**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**} + +#### Software Architecture +Software architecture description + +#### Installation + +1. xxxx +2. xxxx +3. xxxx + +#### Instructions + +1. xxxx +2. xxxx +3. xxxx + +#### Contribution + +1. Fork the repository +2. Create Feat_xxx branch +3. Commit your code +4. Create Pull Request + + +#### Gitee Feature + +1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md +2. Gitee blog [blog.gitee.com](https://blog.gitee.com) +3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) +4. The most valuable open source project [GVP](https://gitee.com/gvp) +5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) +6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README_zh.md b/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..987653b34a17fc92fd548afe9dfc42c46ba2d25d --- /dev/null +++ b/README_zh.md @@ -0,0 +1,42 @@ +# eventhandler + +#### 简介 +​ EventHandler提供了OpenHarmony线程间通信的基本能力,可以通过EventRunner创建新线程,将耗时的操作抛到新线程上执行,从而实现在不阻塞原来的线程的基础上合理地处理耗时任务。 + +​ EventHandler主要包括如下核心模块: + +| 类 | 功能介绍 | +| ------------ | ------------------------------------------------------------ | +| EventRunner | 消息队列的循环分发器,每个线程只有一个EventRunner,主要用于管理消息队列EventQueue,不断地从队列中取出InnerEvent分发至对应的EventHandler处理。 | +| InnerEvent | 线程之间消息传递的实体封装,EventHandler接收与处理的消息对象。EventHandler待处理的InnerEvent的优先级可在IMMEDIATE、HIGH、LOW、IDLE中选择,并设置合适的delayTime。 | +| EventHandler | 发送和处理消息的核心类,通过绑定一个EventRunner实现对消息队列进行循环分发的功能。 | +| EventQueue | 线程消息队列,管理InnerEvent,在初始化EventRunner对象时需要创建一个与之关联的EventQueue。 | + + + +#### 整体架构 +![evenhandler](figures/evenhandler.png) + +#### 目录结构 + + + +``` +base/notification/eventhandler +├── interfaces +│ ├── inner_api # 内部接口存放目录 +│ └── kits # 外部接口存放目录 +│ └── native # C/C++接口   +├── frameworks # 包管理服务框架代码 +│ ├── eventhandler # 内部实现存放目录 +│ ├── napi # js接口实现存放目录 +│ └── native # C/C++接口实现存放目录 +└── test # 测试目录 +``` + + + +#### 使用说明 + +详见[API接口说明文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-emitter.md )。 +