| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| AppScope/ | 06-May-2025 | - | 35 | 32 | ||
| bigdata/ | 06-May-2025 | - | 626 | 567 | ||
| crossconcurrency/ | 06-May-2025 | - | 558 | 492 | ||
| hvigor/ | 06-May-2025 | - | 38 | 36 | ||
| screenshots/ | 06-May-2025 | - | ||||
| .gitignore | D | 06-May-2025 | 133 | 12 | 12 | |
| README.md | D | 06-May-2025 | 3.3 KiB | 85 | 63 | |
| build-profile.json5 | D | 06-May-2025 | 1.6 KiB | 70 | 69 | |
| code-linter.json5 | D | 06-May-2025 | 958 | 35 | 34 | |
| hvigorfile.ts | D | 06-May-2025 | 843 | 22 | 5 | |
| oh-package.json5 | D | 06-May-2025 | 834 | 26 | 24 | |
| ohosTest.md | D | 06-May-2025 | 1 KiB | 9 | 7 |
README.md
1# ArkTS Sendable使用场景 2 3### 介绍 4 5Sendable对象可以在不同并发实例间通过引用传递。通过引用传递方式传输对象相比序列化方式更加高效,同时不会丢失class上携带的成员方法。因此,Sendable主要可以解决两个场景的问题: 6 7- 跨并发实例传输大数据(例如可能达到100KB以上的数据)。 8- 跨并发实例传递带方法的class实例对象。 9 10该工程中展示的代码详细描述可查如下链接: 11 12- [Sendable使用场景](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/arkts-utils/sendable-guide.md) 13 14### 效果预览 15 16| bigdata模块 | crossconcurrency模块 | 17| :----------------------------------------------------------: | :----------------------------------------------------------: | 18| <img src="./screenshots/SendableScenarios_1.png" style="zoom: 50%;" /> | <img src="./screenshots/SendableScenarios_2.png" style="zoom: 50%;" /> | 19 20### 使用说明 21 221. 运行bigdata模块,分别点击Listener task和Data processing task执行程序 232. 执行结果会即时反馈在屏幕中,并在控制台打印log。 243. 运行crossconcurrency模块,点击Hello World执行程序 254. 执行结果会即时反馈在屏幕中,并在控制台打印log。 26 27### 工程目录 28 29``` 30bigdata/src/ 31 ├── main 32 │ ├── ets 33 │ │ ├── entryability 34 │ │ ├── entrybackupability 35 │ │ ├── pages 36 │ │ ├── Index.ets // 跨并发实例传输大数据场景示例代码 37 │ │ ├── sendable.ets // 跨并发实例传输大数据场景示例代码 38 │ ├── module.json5 39 │ └── resources 40 ├── ohosTest 41 │ ├── ets 42 │ │ ├── test 43 │ │ ├── Ability.test.ets // 自动化测试代码 44 crossconcurrency/src/ 45 ├── main 46 │ ├── ets 47 │ │ ├── crossconcurrencyability 48 │ │ ├── pages 49 │ │ ├── Index.ets // 跨并发实例传递带方法的class实例对象示例代码 50 │ │ ├── sendable.ets // 跨并发实例传递带方法的class实例对象示例代码 51 │ ├── module.json5 52 │ └── resources 53 ├── ohosTest 54 │ ├── ets 55 │ │ ├── test 56 │ │ ├── Ability.test.ets // 自动化测试代码 57``` 58 59### 相关权限 60 61不涉及。 62 63### 依赖 64 65不涉及。 66 67### 约束与限制 68 691.本示例仅支持标准系统上运行, 支持设备:RK3568。 70 712.本示例为Stage模型,支持API14版本SDK,版本号:5.0.2.57,镜像版本号:OpenHarmony_5.0.2.58。 72 733.本示例需要使用DevEco Studio 5.0.1 Release (Build Version: 5.0.5.306, built on December 6, 2024)及以上版本才可编译运行。 74 75### 下载 76 77如需单独下载本工程,执行如下命令: 78 79```` 80git init 81git config core.sparsecheckout true 82echo code/DocsSample/ArkTs/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios > .git/info/sparse-checkout 83git remote add origin https://gitee.com/openharmony/applications_app_samples.git 84git pull origin master 85````