| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| AppScope/ | 22-Oct-2025 | - | 40 | 39 | ||
| entry/ | 22-Oct-2025 | - | 809 | 682 | ||
| hvigor/ | 22-Oct-2025 | - | 38 | 37 | ||
| screenshots/ | 22-Oct-2025 | - | ||||
| .gitignore | D | 22-Oct-2025 | 133 | 12 | 12 | |
| README.md | D | 22-Oct-2025 | 2.4 KiB | 73 | 53 | |
| build-profile.json5 | D | 22-Oct-2025 | 1.4 KiB | 58 | 57 | |
| code-linter.json5 | D | 22-Oct-2025 | 1.4 KiB | 47 | 46 | |
| hvigorfile.ts | D | 22-Oct-2025 | 836 | 21 | 5 | |
| oh-package.json5 | D | 22-Oct-2025 | 808 | 25 | 24 | |
| ohosTest.md | D | 22-Oct-2025 | 659 | 8 | 6 |
README.md
1# Node-API常见问题 2 3### 介绍 4 5本工程展示了napi_threadsafe_function内存泄漏,应该如何处理。详细描述可查如下链接。 6 7- [内存泄漏相关问题汇总](https://gitcode.com/openharmony/docs/blob/master/zh-cn/application-dev/napi/napi-faq-about-memory-leak.md) 8 9### 效果预览 10 11| 首页 | 执行及结果即时反馈 | 12| :-------------------------------------------------------------: |:---------------------------------------------------------------------:| 13| <img src="./screenshots/NodeAPIReleaseTsfn_1.png" style="zoom:33%;" width="360;" /> | <img src="./screenshots/NodeAPIReleaseTsfn_2.png" style="zoom:33%;" width="360;" /> | 14 15### 使用说明 16 171. 在主界面,可以点击Hello World,开始执行。 182. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 19 20### 工程目录 21 22``` 23entry/src/ 24 ├── main 25 │ ├── cpp 26 │ │ ├── types 27 │ │ │ └── libentry 28 │ │ ├── CMakeLists.txt 29 │ │ ├── napi_init.cpp // 系统模块加载 30 │ ├── ets 31 │ │ ├── entryability 32 │ │ ├── entrybackupability 33 │ │ ├── pages 34 │ │ │ └── Index.ets // 加载模块 35 │ │ └── workers 36 │ │ └── Worker.ets // Worker线程 37 │ ├── module.json5 38 │ └── resources 39 ├── ohosTest 40 │ ├── ets 41 │ │ └── test 42 │ │ ├── Ability.test.ets 43 │ │ ├── List.test.ets 44 │ │ └── NodeAPIReleaseTsfn.test.ets // 自动化测试代码 45``` 46 47### 相关权限 48 49不涉及。 50 51### 依赖 52 53不涉及。 54 55### 约束与限制 56 571.本示例仅支持标准系统上运行, 支持设备:RK3568。 58 592.本示例为Stage模型,支持API20版本SDK,版本号:6.0.0.40,镜像版本号:OpenHarmony_6.0.0.40。 60 613.本示例需要使用DevEco Studio 5.1.1 Release (Build Version: 5.1.1.820, built on June 28, 2025)及以上版本才可编译运行。 62 63### 下载 64 65如需单独下载本工程,执行如下命令: 66 67``` 68git init 69git config core.sparsecheckout true 70echo code/DocsSample/ArkTS/NodeAPI/NodeAPIFaqs/NodeAPIReleaseTsfn > .git/info/sparse-checkout 71git remote add origin https://gitcode.com/openharmony/applications_app_samples.git 72git pull origin master 73```