mirror of
https://gitee.com/openharmony/napi_generator
synced 2024-11-23 08:20:01 +00:00
fix code check
Signed-off-by: wangshi <wangshi@kaihong.com>
This commit is contained in:
parent
8d287becd3
commit
d4ff4fe8b5
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.example.napitutorials",
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
#### Node-API 介绍
|
||||
|
||||
Node-API(以前称为 N-API)是用于构建原生插件的 API。它独立于底层 JavaScript 运行时(例如 V8),并作为 Node.js 本身的一部分进行维护。此 API 将在 Node.js 的各个版本中保持稳定的应用二进制接口 (ABI)。它旨在将插件与底层 JavaScript 引擎的变化隔离开来,并允许为一个主要版本编译的模块无需重新编译即可在以后的 Node.js 主要版本上运行。[ABI 稳定性](https://nodejs.cn/docs/guides/abi-stability/) 指南提供了更深入的解释。
|
||||
Node-API(以前称为 N-API)是用于构建原生插件的 API。它独立于底层 JavaScript 运行时(例如 V8),并作为 Node.js 本身的一部分进行维护。此 API 将在 Node.js 的各个版本中保持稳定的应用二进制接口 (ABI)。它旨在将插件与底层 JavaScript 引擎的变化隔离开来,并允许为一个主要版本编译的模块无需重新编译即可在以后的 Node.js 主要版本上运行。[ABI 稳定性](docs/guides/abi-stability/) 指南提供了更深入的解释。
|
||||
|
||||
插件是使用标头为 [C++ 插件](https://nodejs.cn/api/addons.html) 的部分中概述的相同方法/工具构建/打包的。唯一的区别是原生代码使用的 API 集。不使用 V8 或 [Node.js 的原生抽象](https://github.com/nodejs/nan) API,而是使用 Node-API 中可用的函数。
|
||||
插件是使用标头为 [C++ 插件](api/addons.html) 的部分中概述的相同方法/工具构建/打包的。唯一的区别是原生代码使用的 API 集。不使用 V8 或 [Node.js 的原生抽象](https://github.com/nodejs/nan) API,而是使用 Node-API 中可用的函数。
|
||||
|
||||
Node-API 公开的 API 通常用于创建和操作 JavaScript 值。概念和操作通常映射到 ECMA-262 语言规范中指定的想法。API 具有以下属性:
|
||||
|
||||
@ -16,7 +16,7 @@ Node-API 公开的 API 通常用于创建和操作 JavaScript 值。概念和操
|
||||
|
||||
- 所有 JavaScript 值都被抽象为一个名为 `napi_value` 的不透明类型。
|
||||
|
||||
- 如果出现错误状态代码,可以使用 `napi_get_last_error_info` 获取附加信息。可以在错误处理部分 [错误处理](https://nodejs.cn/api/n-api.html#error-handling) 中找到更多信息。
|
||||
- 如果出现错误状态代码,可以使用 `napi_get_last_error_info` 获取附加信息。可以在错误处理部分 [错误处理](api/n-api.html#error-handling) 中找到更多信息。
|
||||
|
||||
|
||||
Node-API 是一种 C API,可确保跨 Node.js 版本和不同编译器级别的 ABI 稳定性。C++ API 可以更容易使用。为了支持使用 C++,该项目维护了一个名为 [`node-addon-api`](https://github.com/nodejs/node-addon-api) 的 C++ 封装器模块。这个封装器提供了一个可内联的 C++ API。使用 `node-addon-api` 构建的二进制文件将取决于 Node.js 导出的基于 Node-API C 的函数的符号。`node-addon-api` 是编写调用 Node-API 的代码的更有效方式。
|
||||
@ -67,10 +67,10 @@ Native API是OpenHarmony SDK上提供的一组native开发接口与工具集合
|
||||
| [标准C++库](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/native-lib/third_party_libc/cpp.md) | c++运行时库libc++_shared,此库在打包的时候需要打包或者静态链接到应用中 | 8 |
|
||||
| 日志 | 打印日志到系统的hilog接口 | 8 |
|
||||
| Node-API | ArkUI提供的,方便应用开发接入JS应用环境的一组类Node-API(也叫napi),是属于Native API的一部分 | 8 |
|
||||
| XComponent | ArkUI XComponent组件中的surface与触屏事件接口,方便开发者开发高性能图形应用 | 8 |
|
||||
| XComponent | ArkUI XComponent组件中的界面与触屏事件接口,方便开发者开发高性能图形应用 | 8 |
|
||||
| libuv | ArkUI集成的三方的异步IO库 | 8 |
|
||||
| libz | zlib库,提供基本的压缩,解压接口 | 8 |
|
||||
| Drawing | 系统提供的2D图形库,可以在surface进行绘制 | 8 |
|
||||
| Drawing | 系统提供的2D图形库,可以在界面进行绘制 | 8 |
|
||||
| OpenGL | 系统提供的openglv3接口 | 8 |
|
||||
| Rawfile | 应用资源访问接口,可以读取应用中打包的各种资源 | 8 |
|
||||
| OpenSLES | 用于2D,3D音频加速的接口库 | 8 |
|
||||
@ -127,7 +127,7 @@ OpenCV 教程的目的包括:
|
||||
|
||||
|
||||
|
||||
完成上述步骤后,您就可以在 OpenHarmony 设备上体验 Native API 的能力,并按照 [Node-API]([Node-API | Node.js v20 文档 (nodejs.cn)](https://nodejs.cn/api/n-api.html)) 教程进行进一步的学习和实践了。
|
||||
完成上述步骤后,您就可以在 OpenHarmony 设备上体验 Native API 的能力,并按照 [Node-API]([Node-API | Node.js v20 文档 (nodejs.cn)](api/n-api.html)) 教程进行进一步的学习和实践了。
|
||||
|
||||
|
||||
|
||||
@ -135,220 +135,220 @@ OpenCV 教程的目的包括:
|
||||
|
||||
| 模块 | 接口 | 是否支持 | 备注 |
|
||||
| -------------------------------- | ------------------------------------------------------------ | -------- | ---------- |
|
||||
| 环境生命周期API | [`napi_set_instance_data`](https://nodejs.cn/api/v18/n-api.html#napi_set_instance_data) | 不支持 | 缺少对应库 |
|
||||
| | [`napi_get_instance_data`](https://nodejs.cn/api/v18/n-api.html#napi_get_instance_data) | | |
|
||||
| 环境生命周期API | [`napi_set_instance_data`](api/v18/n-api.html#napi_set_instance_data) | 不支持 | 缺少对应库 |
|
||||
| | [`napi_get_instance_data`](api/v18/n-api.html#napi_get_instance_data) | | |
|
||||
| | | | |
|
||||
| 基本Node-API数据类型 | | | |
|
||||
| | [`napi_status`](https://nodejs.cn/api/v18/n-api.html#napi_status) | | |
|
||||
| | [`napi_extended_error_info`](https://nodejs.cn/api/v18/n-api.html#napi_extended_error_info) | | |
|
||||
| | [`napi_env`](https://nodejs.cn/api/v18/n-api.html#napi_env) | | |
|
||||
| | [`napi_value`](https://nodejs.cn/api/v18/n-api.html#napi_value) | | |
|
||||
| | [`napi_threadsafe_function`](https://nodejs.cn/api/v18/n-api.html#napi_threadsafe_function) | | |
|
||||
| | [`napi_threadsafe_function_release_mode`](https://nodejs.cn/api/v18/n-api.html#napi_threadsafe_function_release_mode) | | |
|
||||
| | [`napi_threadsafe_function_call_mode`](https://nodejs.cn/api/v18/n-api.html#napi_threadsafe_function_call_mode) | | |
|
||||
| | [`napi_status`](api/v18/n-api.html#napi_status) | | |
|
||||
| | [`napi_extended_error_info`](api/v18/n-api.html#napi_extended_error_info) | | |
|
||||
| | [`napi_env`](api/v18/n-api.html#napi_env) | | |
|
||||
| | [`napi_value`](api/v18/n-api.html#napi_value) | | |
|
||||
| | [`napi_threadsafe_function`](api/v18/n-api.html#napi_threadsafe_function) | | |
|
||||
| | [`napi_threadsafe_function_release_mode`](api/v18/n-api.html#napi_threadsafe_function_release_mode) | | |
|
||||
| | [`napi_threadsafe_function_call_mode`](api/v18/n-api.html#napi_threadsafe_function_call_mode) | | |
|
||||
| | | | |
|
||||
| Node-API内存管理类型 | [`napi_handle_scope`](https://nodejs.cn/api/v18/n-api.html#napi_handle_scope) | | |
|
||||
| | [`napi_escapable_handle_scope`](https://nodejs.cn/api/v18/n-api.html#napi_escapable_handle_scope) | | |
|
||||
| | [`napi_ref`](https://nodejs.cn/api/v18/n-api.html#napi_ref) | | |
|
||||
| | [`napi_type_tag`](https://nodejs.cn/api/v18/n-api.html#napi_type_tag) | | |
|
||||
| | [`napi_async_cleanup_hook_handle`](https://nodejs.cn/api/v18/n-api.html#napi_async_cleanup_hook_handle) | | |
|
||||
| Node-API内存管理类型 | [`napi_handle_scope`](api/v18/n-api.html#napi_handle_scope) | | |
|
||||
| | [`napi_escapable_handle_scope`](api/v18/n-api.html#napi_escapable_handle_scope) | | |
|
||||
| | [`napi_ref`](api/v18/n-api.html#napi_ref) | | |
|
||||
| | [`napi_type_tag`](api/v18/n-api.html#napi_type_tag) | | |
|
||||
| | [`napi_async_cleanup_hook_handle`](api/v18/n-api.html#napi_async_cleanup_hook_handle) | | |
|
||||
| | | | |
|
||||
| Node-API回调类型 | [`napi_callback_info`](https://nodejs.cn/api/v18/n-api.html#napi_callback_info) | | |
|
||||
| | [`napi_callback`](https://nodejs.cn/api/v18/n-api.html#napi_callback) | | |
|
||||
| | [`napi_finalize`](https://nodejs.cn/api/v18/n-api.html#napi_finalize) | | |
|
||||
| | [`napi_async_execute_callback`](https://nodejs.cn/api/v18/n-api.html#napi_async_execute_callback) | | |
|
||||
| | [`napi_async_complete_callback`](https://nodejs.cn/api/v18/n-api.html#napi_async_complete_callback) | | |
|
||||
| | [`napi_threadsafe_function_call_js`](https://nodejs.cn/api/v18/n-api.html#napi_threadsafe_function_call_js) | | |
|
||||
| | [`napi_cleanup_hook`](https://nodejs.cn/api/v18/n-api.html#napi_cleanup_hook) | | |
|
||||
| | [`napi_async_cleanup_hook`](https://nodejs.cn/api/v18/n-api.html#napi_async_cleanup_hook) | | |
|
||||
| Node-API回调类型 | [`napi_callback_info`](api/v18/n-api.html#napi_callback_info) | | |
|
||||
| | [`napi_callback`](api/v18/n-api.html#napi_callback) | | |
|
||||
| | [`napi_finalize`](api/v18/n-api.html#napi_finalize) | | |
|
||||
| | [`napi_async_execute_callback`](api/v18/n-api.html#napi_async_execute_callback) | | |
|
||||
| | [`napi_async_complete_callback`](api/v18/n-api.html#napi_async_complete_callback) | | |
|
||||
| | [`napi_threadsafe_function_call_js`](api/v18/n-api.html#napi_threadsafe_function_call_js) | | |
|
||||
| | [`napi_cleanup_hook`](api/v18/n-api.html#napi_cleanup_hook) | | |
|
||||
| | [`napi_async_cleanup_hook`](api/v18/n-api.html#napi_async_cleanup_hook) | | |
|
||||
| | | | |
|
||||
| 错误处理 | | | |
|
||||
| 返回值 | [`napi_get_last_error_info`](https://nodejs.cn/api/v18/n-api.html#napi_get_last_error_info) | | |
|
||||
| 返回值 | [`napi_get_last_error_info`](api/v18/n-api.html#napi_get_last_error_info) | | |
|
||||
| | | | |
|
||||
| 异常 | [`napi_throw`](https://nodejs.cn/api/v18/n-api.html#napi_throw) | | |
|
||||
| | [`napi_throw_error`](https://nodejs.cn/api/v18/n-api.html#napi_throw_error) | | |
|
||||
| | [`napi_throw_type_error`](https://nodejs.cn/api/v18/n-api.html#napi_throw_type_error) | | |
|
||||
| | [`napi_throw_range_error`](https://nodejs.cn/api/v18/n-api.html#napi_throw_range_error) | | |
|
||||
| | [`node_api_throw_syntax_error`](https://nodejs.cn/api/v18/n-api.html#node_api_throw_syntax_error) | | |
|
||||
| | [`napi_is_error`](https://nodejs.cn/api/v18/n-api.html#napi_is_error) | | |
|
||||
| | [`napi_create_error`](https://nodejs.cn/api/v18/n-api.html#napi_create_error) | | |
|
||||
| | [`napi_create_type_error`](https://nodejs.cn/api/v18/n-api.html#napi_create_type_error) | | |
|
||||
| | [`napi_create_range_error`](https://nodejs.cn/api/v18/n-api.html#napi_create_range_error) | | |
|
||||
| | [`node_api_create_syntax_error`](https://nodejs.cn/api/v18/n-api.html#node_api_create_syntax_error) | | |
|
||||
| | [`napi_get_and_clear_last_exception`](https://nodejs.cn/api/v18/n-api.html#napi_get_and_clear_last_exception) | | |
|
||||
| | [`napi_is_exception_pending`](https://nodejs.cn/api/v18/n-api.html#napi_is_exception_pending) | | |
|
||||
| | [`napi_fatal_exception`](https://nodejs.cn/api/v18/n-api.html#napi_fatal_exception) | | |
|
||||
| 异常 | [`napi_throw`](api/v18/n-api.html#napi_throw) | | |
|
||||
| | [`napi_throw_error`](api/v18/n-api.html#napi_throw_error) | | |
|
||||
| | [`napi_throw_type_error`](api/v18/n-api.html#napi_throw_type_error) | | |
|
||||
| | [`napi_throw_range_error`](api/v18/n-api.html#napi_throw_range_error) | | |
|
||||
| | [`node_api_throw_syntax_error`](api/v18/n-api.html#node_api_throw_syntax_error) | | |
|
||||
| | [`napi_is_error`](api/v18/n-api.html#napi_is_error) | | |
|
||||
| | [`napi_create_error`](api/v18/n-api.html#napi_create_error) | | |
|
||||
| | [`napi_create_type_error`](api/v18/n-api.html#napi_create_type_error) | | |
|
||||
| | [`napi_create_range_error`](api/v18/n-api.html#napi_create_range_error) | | |
|
||||
| | [`node_api_create_syntax_error`](api/v18/n-api.html#node_api_create_syntax_error) | | |
|
||||
| | [`napi_get_and_clear_last_exception`](api/v18/n-api.html#napi_get_and_clear_last_exception) | | |
|
||||
| | [`napi_is_exception_pending`](api/v18/n-api.html#napi_is_exception_pending) | | |
|
||||
| | [`napi_fatal_exception`](api/v18/n-api.html#napi_fatal_exception) | | |
|
||||
| | | | |
|
||||
| 致命错误 | [`napi_fatal_error`](https://nodejs.cn/api/v18/n-api.html#napi_fatal_error) | | |
|
||||
| 致命错误 | [`napi_fatal_error`](api/v18/n-api.html#napi_fatal_error) | | |
|
||||
| | | | |
|
||||
| 对象生命周期管理 | | | |
|
||||
| 使句柄寿命短于本地方法 | [`napi_open_handle_scope`](https://nodejs.cn/api/v18/n-api.html#napi_open_handle_scope) | | |
|
||||
| | [`napi_close_handle_scope`](https://nodejs.cn/api/v18/n-api.html#napi_close_handle_scope) | | |
|
||||
| | [`napi_open_escapable_handle_scope`](https://nodejs.cn/api/v18/n-api.html#napi_open_escapable_handle_scope) | | |
|
||||
| | [`napi_close_escapable_handle_scope`](https://nodejs.cn/api/v18/n-api.html#napi_close_escapable_handle_scope) | | |
|
||||
| | [`napi_escape_handle`](https://nodejs.cn/api/v18/n-api.html#napi_escape_handle) | | |
|
||||
| 使句柄寿命短于本地方法 | [`napi_open_handle_scope`](api/v18/n-api.html#napi_open_handle_scope) | | |
|
||||
| | [`napi_close_handle_scope`](api/v18/n-api.html#napi_close_handle_scope) | | |
|
||||
| | [`napi_open_escapable_handle_scope`](api/v18/n-api.html#napi_open_escapable_handle_scope) | | |
|
||||
| | [`napi_close_escapable_handle_scope`](api/v18/n-api.html#napi_close_escapable_handle_scope) | | |
|
||||
| | [`napi_escape_handle`](api/v18/n-api.html#napi_escape_handle) | | |
|
||||
| | | | |
|
||||
| 对生命周期比原生方法长的值的引用 | [`napi_create_reference`](https://nodejs.cn/api/v18/n-api.html#napi_create_reference) | | |
|
||||
| | [`napi_delete_reference`](https://nodejs.cn/api/v18/n-api.html#napi_delete_reference) | | |
|
||||
| | [`napi_reference_ref`](https://nodejs.cn/api/v18/n-api.html#napi_reference_ref) | | |
|
||||
| | [`napi_reference_unref`](https://nodejs.cn/api/v18/n-api.html#napi_reference_unref) | | |
|
||||
| | [`napi_get_reference_value`](https://nodejs.cn/api/v18/n-api.html#napi_get_reference_value) | | |
|
||||
| 对生命周期比原生方法长的值的引用 | [`napi_create_reference`](api/v18/n-api.html#napi_create_reference) | | |
|
||||
| | [`napi_delete_reference`](api/v18/n-api.html#napi_delete_reference) | | |
|
||||
| | [`napi_reference_ref`](api/v18/n-api.html#napi_reference_ref) | | |
|
||||
| | [`napi_reference_unref`](api/v18/n-api.html#napi_reference_unref) | | |
|
||||
| | [`napi_get_reference_value`](api/v18/n-api.html#napi_get_reference_value) | | |
|
||||
| | | | |
|
||||
| 当前 Node.js 环境退出时的清理 | [`napi_add_env_cleanup_hook`](https://nodejs.cn/api/v18/n-api.html#napi_add_env_cleanup_hook) | | |
|
||||
| | [`napi_remove_env_cleanup_hook`](https://nodejs.cn/api/v18/n-api.html#napi_remove_env_cleanup_hook) | | |
|
||||
| | [`napi_add_async_cleanup_hook`](https://nodejs.cn/api/v18/n-api.html#napi_add_async_cleanup_hook) | | |
|
||||
| | [`napi_remove_async_cleanup_hook`](https://nodejs.cn/api/v18/n-api.html#napi_remove_async_cleanup_hook) | | |
|
||||
| 当前 Node.js 环境退出时的清理 | [`napi_add_env_cleanup_hook`](api/v18/n-api.html#napi_add_env_cleanup_hook) | | |
|
||||
| | [`napi_remove_env_cleanup_hook`](api/v18/n-api.html#napi_remove_env_cleanup_hook) | | |
|
||||
| | [`napi_add_async_cleanup_hook`](api/v18/n-api.html#napi_add_async_cleanup_hook) | | |
|
||||
| | [`napi_remove_async_cleanup_hook`](api/v18/n-api.html#napi_remove_async_cleanup_hook) | | |
|
||||
| 在Node.js环境退出时完成 | | | |
|
||||
| | | | |
|
||||
| 模块注册 | | | |
|
||||
| | | | |
|
||||
| 使用JavaScript值 | | | |
|
||||
| 枚举类型 | [`napi_key_collection_mode`](https://nodejs.cn/api/v18/n-api.html#napi_key_collection_mode) | | |
|
||||
| | [`napi_key_filter`](https://nodejs.cn/api/v18/n-api.html#napi_key_filter) | | |
|
||||
| | [`napi_key_conversion`](https://nodejs.cn/api/v18/n-api.html#napi_key_conversion) | | |
|
||||
| | [`napi_valuetype`](https://nodejs.cn/api/v18/n-api.html#napi_valuetype) | | |
|
||||
| | [`napi_typedarray_type`](https://nodejs.cn/api/v18/n-api.html#napi_typedarray_type) | | |
|
||||
| 枚举类型 | [`napi_key_collection_mode`](api/v18/n-api.html#napi_key_collection_mode) | | |
|
||||
| | [`napi_key_filter`](api/v18/n-api.html#napi_key_filter) | | |
|
||||
| | [`napi_key_conversion`](api/v18/n-api.html#napi_key_conversion) | | |
|
||||
| | [`napi_valuetype`](api/v18/n-api.html#napi_valuetype) | | |
|
||||
| | [`napi_typedarray_type`](api/v18/n-api.html#napi_typedarray_type) | | |
|
||||
| | | | |
|
||||
| 对象创建函数 | [`napi_create_array`](https://nodejs.cn/api/v18/n-api.html#napi_create_array) | | |
|
||||
| | [`napi_create_array_with_length`](https://nodejs.cn/api/v18/n-api.html#napi_create_array_with_length) | | |
|
||||
| | [`napi_create_arraybuffer`](https://nodejs.cn/api/v18/n-api.html#napi_create_arraybuffer) | | |
|
||||
| | [`napi_create_buffer`](https://nodejs.cn/api/v18/n-api.html#napi_create_buffer) | | |
|
||||
| | [`napi_create_buffer_copy`](https://nodejs.cn/api/v18/n-api.html#napi_create_buffer_copy) | | |
|
||||
| | [`napi_create_date`](https://nodejs.cn/api/v18/n-api.html#napi_create_date) | | |
|
||||
| | [`napi_create_external`](https://nodejs.cn/api/v18/n-api.html#napi_create_external) | | |
|
||||
| | [`napi_create_external_arraybuffer`](https://nodejs.cn/api/v18/n-api.html#napi_create_external_arraybuffer) | | |
|
||||
| | [`napi_create_external_buffer`](https://nodejs.cn/api/v18/n-api.html#napi_create_external_buffer) | | |
|
||||
| | [`napi_create_object`](https://nodejs.cn/api/v18/n-api.html#napi_create_object) | | |
|
||||
| | [`napi_create_symbol`](https://nodejs.cn/api/v18/n-api.html#napi_create_symbol) | | |
|
||||
| | [`node_api_symbol_for`](https://nodejs.cn/api/v18/n-api.html#node_api_symbol_for) | | |
|
||||
| | [`napi_create_typedarray`](https://nodejs.cn/api/v18/n-api.html#napi_create_typedarray) | | |
|
||||
| | [`napi_create_dataview`](https://nodejs.cn/api/v18/n-api.html#napi_create_dataview) | | |
|
||||
| 对象创建函数 | [`napi_create_array`](api/v18/n-api.html#napi_create_array) | | |
|
||||
| | [`napi_create_array_with_length`](api/v18/n-api.html#napi_create_array_with_length) | | |
|
||||
| | [`napi_create_arraybuffer`](api/v18/n-api.html#napi_create_arraybuffer) | | |
|
||||
| | [`napi_create_buffer`](api/v18/n-api.html#napi_create_buffer) | | |
|
||||
| | [`napi_create_buffer_copy`](api/v18/n-api.html#napi_create_buffer_copy) | | |
|
||||
| | [`napi_create_date`](api/v18/n-api.html#napi_create_date) | | |
|
||||
| | [`napi_create_external`](api/v18/n-api.html#napi_create_external) | | |
|
||||
| | [`napi_create_external_arraybuffer`](api/v18/n-api.html#napi_create_external_arraybuffer) | | |
|
||||
| | [`napi_create_external_buffer`](api/v18/n-api.html#napi_create_external_buffer) | | |
|
||||
| | [`napi_create_object`](api/v18/n-api.html#napi_create_object) | | |
|
||||
| | [`napi_create_symbol`](api/v18/n-api.html#napi_create_symbol) | | |
|
||||
| | [`node_api_symbol_for`](api/v18/n-api.html#node_api_symbol_for) | | |
|
||||
| | [`napi_create_typedarray`](api/v18/n-api.html#napi_create_typedarray) | | |
|
||||
| | [`napi_create_dataview`](api/v18/n-api.html#napi_create_dataview) | | |
|
||||
| | | | |
|
||||
| 从 C 类型转换为 Node-API 的函数 | [`napi_create_int32`](https://nodejs.cn/api/v18/n-api.html#napi_create_int32) | | |
|
||||
| | [`napi_create_uint32`](https://nodejs.cn/api/v18/n-api.html#napi_create_uint32) | | |
|
||||
| | [`napi_create_int64`](https://nodejs.cn/api/v18/n-api.html#napi_create_int64) | | |
|
||||
| | [`napi_create_double`](https://nodejs.cn/api/v18/n-api.html#napi_create_double) | | |
|
||||
| | [`napi_create_bigint_int64`](https://nodejs.cn/api/v18/n-api.html#napi_create_bigint_int64) | | |
|
||||
| | [`napi_create_bigint_uint64`](https://nodejs.cn/api/v18/n-api.html#napi_create_bigint_uint64) | | |
|
||||
| | [`napi_create_bigint_words`](https://nodejs.cn/api/v18/n-api.html#napi_create_bigint_words) | | |
|
||||
| | [`napi_create_string_latin1`](https://nodejs.cn/api/v18/n-api.html#napi_create_string_latin1) | | |
|
||||
| | [`node_api_create_external_string_latin1`](https://nodejs.cn/api/v18/n-api.html#node_api_create_external_string_latin1) | | |
|
||||
| | [`napi_create_string_utf16`](https://nodejs.cn/api/v18/n-api.html#napi_create_string_utf16) | | |
|
||||
| | [`node_api_create_external_string_utf16`](https://nodejs.cn/api/v18/n-api.html#node_api_create_external_string_utf16) | | |
|
||||
| | [`napi_create_string_utf8`](https://nodejs.cn/api/v18/n-api.html#napi_create_string_utf8) | | |
|
||||
| 从 C 类型转换为 Node-API 的函数 | [`napi_create_int32`](api/v18/n-api.html#napi_create_int32) | | |
|
||||
| | [`napi_create_uint32`](api/v18/n-api.html#napi_create_uint32) | | |
|
||||
| | [`napi_create_int64`](api/v18/n-api.html#napi_create_int64) | | |
|
||||
| | [`napi_create_double`](api/v18/n-api.html#napi_create_double) | | |
|
||||
| | [`napi_create_bigint_int64`](api/v18/n-api.html#napi_create_bigint_int64) | | |
|
||||
| | [`napi_create_bigint_uint64`](api/v18/n-api.html#napi_create_bigint_uint64) | | |
|
||||
| | [`napi_create_bigint_words`](api/v18/n-api.html#napi_create_bigint_words) | | |
|
||||
| | [`napi_create_string_latin1`](api/v18/n-api.html#napi_create_string_latin1) | | |
|
||||
| | [`node_api_create_external_string_latin1`](api/v18/n-api.html#node_api_create_external_string_latin1) | | |
|
||||
| | [`napi_create_string_utf16`](api/v18/n-api.html#napi_create_string_utf16) | | |
|
||||
| | [`node_api_create_external_string_utf16`](api/v18/n-api.html#node_api_create_external_string_utf16) | | |
|
||||
| | [`napi_create_string_utf8`](api/v18/n-api.html#napi_create_string_utf8) | | |
|
||||
| | | | |
|
||||
| 从Node-API转换为C类型的函数 | [`napi_get_array_length`](https://nodejs.cn/api/v18/n-api.html#napi_get_array_length) | | |
|
||||
| | [`napi_get_arraybuffer_info`](https://nodejs.cn/api/v18/n-api.html#napi_get_arraybuffer_info) | | |
|
||||
| | [`napi_get_buffer_info`](https://nodejs.cn/api/v18/n-api.html#napi_get_buffer_info) | | |
|
||||
| | [`napi_get_prototype`](https://nodejs.cn/api/v18/n-api.html#napi_get_prototype) | | |
|
||||
| | [`napi_get_typedarray_info`](https://nodejs.cn/api/v18/n-api.html#napi_get_typedarray_info) | | |
|
||||
| | [`napi_get_dataview_info`](https://nodejs.cn/api/v18/n-api.html#napi_get_dataview_info) | | |
|
||||
| | [`napi_get_date_value`](https://nodejs.cn/api/v18/n-api.html#napi_get_date_value) | | |
|
||||
| | [`napi_get_value_bool`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_bool) | | |
|
||||
| | [`napi_get_value_double`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_double) | | |
|
||||
| | [`napi_get_value_bigint_int64`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_bigint_int64) | | |
|
||||
| | [`napi_get_value_bigint_uint64`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_bigint_uint64) | | |
|
||||
| | [`napi_get_value_bigint_words`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_bigint_words) | | |
|
||||
| | [`napi_get_value_external`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_external) | | |
|
||||
| | [`napi_get_value_int32`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_int32) | | |
|
||||
| | [`napi_get_value_int64`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_int64) | | |
|
||||
| | [`napi_get_value_string_latin1`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_string_latin1) | | |
|
||||
| | [`napi_get_value_string_utf8`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_string_utf8) | | |
|
||||
| | [`napi_get_value_string_utf16`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_string_utf16) | | |
|
||||
| | [`napi_get_value_uint32`](https://nodejs.cn/api/v18/n-api.html#napi_get_value_uint32) | | |
|
||||
| 从Node-API转换为C类型的函数 | [`napi_get_array_length`](api/v18/n-api.html#napi_get_array_length) | | |
|
||||
| | [`napi_get_arraybuffer_info`](api/v18/n-api.html#napi_get_arraybuffer_info) | | |
|
||||
| | [`napi_get_buffer_info`](api/v18/n-api.html#napi_get_buffer_info) | | |
|
||||
| | [`napi_get_prototype`](api/v18/n-api.html#napi_get_prototype) | | |
|
||||
| | [`napi_get_typedarray_info`](api/v18/n-api.html#napi_get_typedarray_info) | | |
|
||||
| | [`napi_get_dataview_info`](api/v18/n-api.html#napi_get_dataview_info) | | |
|
||||
| | [`napi_get_date_value`](api/v18/n-api.html#napi_get_date_value) | | |
|
||||
| | [`napi_get_value_bool`](api/v18/n-api.html#napi_get_value_bool) | | |
|
||||
| | [`napi_get_value_double`](api/v18/n-api.html#napi_get_value_double) | | |
|
||||
| | [`napi_get_value_bigint_int64`](api/v18/n-api.html#napi_get_value_bigint_int64) | | |
|
||||
| | [`napi_get_value_bigint_uint64`](api/v18/n-api.html#napi_get_value_bigint_uint64) | | |
|
||||
| | [`napi_get_value_bigint_words`](api/v18/n-api.html#napi_get_value_bigint_words) | | |
|
||||
| | [`napi_get_value_external`](api/v18/n-api.html#napi_get_value_external) | | |
|
||||
| | [`napi_get_value_int32`](api/v18/n-api.html#napi_get_value_int32) | | |
|
||||
| | [`napi_get_value_int64`](api/v18/n-api.html#napi_get_value_int64) | | |
|
||||
| | [`napi_get_value_string_latin1`](api/v18/n-api.html#napi_get_value_string_latin1) | | |
|
||||
| | [`napi_get_value_string_utf8`](api/v18/n-api.html#napi_get_value_string_utf8) | | |
|
||||
| | [`napi_get_value_string_utf16`](api/v18/n-api.html#napi_get_value_string_utf16) | | |
|
||||
| | [`napi_get_value_uint32`](api/v18/n-api.html#napi_get_value_uint32) | | |
|
||||
| | | | |
|
||||
| 获取全局实例的函数 | [`napi_get_boolean`](https://nodejs.cn/api/v18/n-api.html#napi_get_boolean) | | |
|
||||
| | [`napi_get_global`](https://nodejs.cn/api/v18/n-api.html#napi_get_global) | | |
|
||||
| | [`napi_get_null`](https://nodejs.cn/api/v18/n-api.html#napi_get_null) | | |
|
||||
| | [`napi_get_undefined`](https://nodejs.cn/api/v18/n-api.html#napi_get_undefined) | | |
|
||||
| 获取全局实例的函数 | [`napi_get_boolean`](api/v18/n-api.html#napi_get_boolean) | | |
|
||||
| | [`napi_get_global`](api/v18/n-api.html#napi_get_global) | | |
|
||||
| | [`napi_get_null`](api/v18/n-api.html#napi_get_null) | | |
|
||||
| | [`napi_get_undefined`](api/v18/n-api.html#napi_get_undefined) | | |
|
||||
| | | | |
|
||||
| 使用JavaScript值和抽象操作 | [`napi_coerce_to_bool`](https://nodejs.cn/api/v18/n-api.html#napi_coerce_to_bool) | | |
|
||||
| | [`napi_coerce_to_number`](https://nodejs.cn/api/v18/n-api.html#napi_coerce_to_number) | | |
|
||||
| | [`napi_coerce_to_object`](https://nodejs.cn/api/v18/n-api.html#napi_coerce_to_object) | | |
|
||||
| | [`napi_coerce_to_string`](https://nodejs.cn/api/v18/n-api.html#napi_coerce_to_string) | | |
|
||||
| | [`napi_typeof`](https://nodejs.cn/api/v18/n-api.html#napi_typeof) | | |
|
||||
| | [`napi_instanceof`](https://nodejs.cn/api/v18/n-api.html#napi_instanceof) | | |
|
||||
| | [`napi_is_array`](https://nodejs.cn/api/v18/n-api.html#napi_is_array) | | |
|
||||
| | [`napi_is_arraybuffer`](https://nodejs.cn/api/v18/n-api.html#napi_is_arraybuffer) | | |
|
||||
| | [`napi_is_buffer`](https://nodejs.cn/api/v18/n-api.html#napi_is_buffer) | | |
|
||||
| | [`napi_is_date`](https://nodejs.cn/api/v18/n-api.html#napi_is_date) | | |
|
||||
| | [`napi_is_error`](https://nodejs.cn/api/v18/n-api.html#napi_is_error_1) | | |
|
||||
| | [`napi_is_typedarray`](https://nodejs.cn/api/v18/n-api.html#napi_is_typedarray) | | |
|
||||
| | [`napi_is_dataview`](https://nodejs.cn/api/v18/n-api.html#napi_is_dataview) | | |
|
||||
| | [`napi_strict_equals`](https://nodejs.cn/api/v18/n-api.html#napi_strict_equals) | | |
|
||||
| | [`napi_detach_arraybuffer`](https://nodejs.cn/api/v18/n-api.html#napi_detach_arraybuffer) | | |
|
||||
| | [`napi_is_detached_arraybuffer`](https://nodejs.cn/api/v18/n-api.html#napi_is_detached_arraybuffer) | | |
|
||||
| 使用JavaScript值和抽象操作 | [`napi_coerce_to_bool`](api/v18/n-api.html#napi_coerce_to_bool) | | |
|
||||
| | [`napi_coerce_to_number`](api/v18/n-api.html#napi_coerce_to_number) | | |
|
||||
| | [`napi_coerce_to_object`](api/v18/n-api.html#napi_coerce_to_object) | | |
|
||||
| | [`napi_coerce_to_string`](api/v18/n-api.html#napi_coerce_to_string) | | |
|
||||
| | [`napi_typeof`](api/v18/n-api.html#napi_typeof) | | |
|
||||
| | [`napi_instanceof`](api/v18/n-api.html#napi_instanceof) | | |
|
||||
| | [`napi_is_array`](api/v18/n-api.html#napi_is_array) | | |
|
||||
| | [`napi_is_arraybuffer`](api/v18/n-api.html#napi_is_arraybuffer) | | |
|
||||
| | [`napi_is_buffer`](api/v18/n-api.html#napi_is_buffer) | | |
|
||||
| | [`napi_is_date`](api/v18/n-api.html#napi_is_date) | | |
|
||||
| | [`napi_is_error`](api/v18/n-api.html#napi_is_error_1) | | |
|
||||
| | [`napi_is_typedarray`](api/v18/n-api.html#napi_is_typedarray) | | |
|
||||
| | [`napi_is_dataview`](api/v18/n-api.html#napi_is_dataview) | | |
|
||||
| | [`napi_strict_equals`](api/v18/n-api.html#napi_strict_equals) | | |
|
||||
| | [`napi_detach_arraybuffer`](api/v18/n-api.html#napi_detach_arraybuffer) | | |
|
||||
| | [`napi_is_detached_arraybuffer`](api/v18/n-api.html#napi_is_detached_arraybuffer) | | |
|
||||
| | | | |
|
||||
| 使用JavaScript属性 | | | |
|
||||
| 结构 | [`napi_property_attributes`](https://nodejs.cn/api/v18/n-api.html#napi_property_attributes) [`napi_property_descriptor`](https://nodejs.cn/api/v18/n-api.html#napi_property_descriptor) | | |
|
||||
| 结构 | [`napi_property_attributes`](api/v18/n-api.html#napi_property_attributes) [`napi_property_descriptor`](api/v18/n-api.html#napi_property_descriptor) | | |
|
||||
| | | | |
|
||||
| 函数 | [`napi_get_property_names`](https://nodejs.cn/api/v18/n-api.html#napi_get_property_names) | | |
|
||||
| | [`napi_get_all_property_names`](https://nodejs.cn/api/v18/n-api.html#napi_get_all_property_names) | | |
|
||||
| | [`napi_set_property`](https://nodejs.cn/api/v18/n-api.html#napi_set_property) | | |
|
||||
| | [`napi_get_property`](https://nodejs.cn/api/v18/n-api.html#napi_get_property) | | |
|
||||
| | [`napi_has_property`](https://nodejs.cn/api/v18/n-api.html#napi_has_property) | | |
|
||||
| | [`napi_delete_property`](https://nodejs.cn/api/v18/n-api.html#napi_delete_property) | | |
|
||||
| | [`napi_has_own_property`](https://nodejs.cn/api/v18/n-api.html#napi_has_own_property) | | |
|
||||
| | [`napi_set_named_property`](https://nodejs.cn/api/v18/n-api.html#napi_set_named_property) | | |
|
||||
| | [`napi_get_named_property`](https://nodejs.cn/api/v18/n-api.html#napi_get_named_property) | | |
|
||||
| | [`napi_has_named_property`](https://nodejs.cn/api/v18/n-api.html#napi_has_named_property) | | |
|
||||
| | [`napi_set_element`](https://nodejs.cn/api/v18/n-api.html#napi_set_element) | | |
|
||||
| | [`napi_get_element`](https://nodejs.cn/api/v18/n-api.html#napi_get_element) | | |
|
||||
| | [`napi_has_element`](https://nodejs.cn/api/v18/n-api.html#napi_has_element) | | |
|
||||
| | [`napi_delete_element`](https://nodejs.cn/api/v18/n-api.html#napi_delete_element) | | |
|
||||
| | [`napi_define_properties`](https://nodejs.cn/api/v18/n-api.html#napi_define_properties) | | |
|
||||
| | [`napi_object_freeze`](https://nodejs.cn/api/v18/n-api.html#napi_object_freeze) | | |
|
||||
| | [`napi_object_seal`](https://nodejs.cn/api/v18/n-api.html#napi_object_seal) | | |
|
||||
| 函数 | [`napi_get_property_names`](api/v18/n-api.html#napi_get_property_names) | | |
|
||||
| | [`napi_get_all_property_names`](api/v18/n-api.html#napi_get_all_property_names) | | |
|
||||
| | [`napi_set_property`](api/v18/n-api.html#napi_set_property) | | |
|
||||
| | [`napi_get_property`](api/v18/n-api.html#napi_get_property) | | |
|
||||
| | [`napi_has_property`](api/v18/n-api.html#napi_has_property) | | |
|
||||
| | [`napi_delete_property`](api/v18/n-api.html#napi_delete_property) | | |
|
||||
| | [`napi_has_own_property`](api/v18/n-api.html#napi_has_own_property) | | |
|
||||
| | [`napi_set_named_property`](api/v18/n-api.html#napi_set_named_property) | | |
|
||||
| | [`napi_get_named_property`](api/v18/n-api.html#napi_get_named_property) | | |
|
||||
| | [`napi_has_named_property`](api/v18/n-api.html#napi_has_named_property) | | |
|
||||
| | [`napi_set_element`](api/v18/n-api.html#napi_set_element) | | |
|
||||
| | [`napi_get_element`](api/v18/n-api.html#napi_get_element) | | |
|
||||
| | [`napi_has_element`](api/v18/n-api.html#napi_has_element) | | |
|
||||
| | [`napi_delete_element`](api/v18/n-api.html#napi_delete_element) | | |
|
||||
| | [`napi_define_properties`](api/v18/n-api.html#napi_define_properties) | | |
|
||||
| | [`napi_object_freeze`](api/v18/n-api.html#napi_object_freeze) | | |
|
||||
| | [`napi_object_seal`](api/v18/n-api.html#napi_object_seal) | | |
|
||||
| | | | |
|
||||
| 使用JavaScript函数 | [`napi_call_function`](https://nodejs.cn/api/v18/n-api.html#napi_call_function) | | |
|
||||
| | [`napi_create_function`](https://nodejs.cn/api/v18/n-api.html#napi_create_function) | | |
|
||||
| | [`napi_get_cb_info`](https://nodejs.cn/api/v18/n-api.html#napi_get_cb_info) | | |
|
||||
| | [`napi_get_new_target`](https://nodejs.cn/api/v18/n-api.html#napi_get_new_target) | | |
|
||||
| | [`napi_new_instance`](https://nodejs.cn/api/v18/n-api.html#napi_new_instance) | | |
|
||||
| 使用JavaScript函数 | [`napi_call_function`](api/v18/n-api.html#napi_call_function) | | |
|
||||
| | [`napi_create_function`](api/v18/n-api.html#napi_create_function) | | |
|
||||
| | [`napi_get_cb_info`](api/v18/n-api.html#napi_get_cb_info) | | |
|
||||
| | [`napi_get_new_target`](api/v18/n-api.html#napi_get_new_target) | | |
|
||||
| | [`napi_new_instance`](api/v18/n-api.html#napi_new_instance) | | |
|
||||
| | | | |
|
||||
| 对象封装 | [`napi_define_class`](https://nodejs.cn/api/v18/n-api.html#napi_define_class) | | |
|
||||
| | [`napi_wrap`](https://nodejs.cn/api/v18/n-api.html#napi_wrap) | | |
|
||||
| | [`napi_unwrap`](https://nodejs.cn/api/v18/n-api.html#napi_unwrap) | | |
|
||||
| | [`napi_remove_wrap`](https://nodejs.cn/api/v18/n-api.html#napi_remove_wrap) | | |
|
||||
| | [`napi_type_tag_object`](https://nodejs.cn/api/v18/n-api.html#napi_type_tag_object) | | |
|
||||
| | [`napi_check_object_type_tag`](https://nodejs.cn/api/v18/n-api.html#napi_check_object_type_tag) | | |
|
||||
| | [`napi_add_finalizer`](https://nodejs.cn/api/v18/n-api.html#napi_add_finalizer) | | |
|
||||
| | [`node_api_post_finalizer`](https://nodejs.cn/api/v18/n-api.html#node_api_post_finalizer) | | |
|
||||
| 对象封装 | [`napi_define_class`](api/v18/n-api.html#napi_define_class) | | |
|
||||
| | [`napi_wrap`](api/v18/n-api.html#napi_wrap) | | |
|
||||
| | [`napi_unwrap`](api/v18/n-api.html#napi_unwrap) | | |
|
||||
| | [`napi_remove_wrap`](api/v18/n-api.html#napi_remove_wrap) | | |
|
||||
| | [`napi_type_tag_object`](api/v18/n-api.html#napi_type_tag_object) | | |
|
||||
| | [`napi_check_object_type_tag`](api/v18/n-api.html#napi_check_object_type_tag) | | |
|
||||
| | [`napi_add_finalizer`](api/v18/n-api.html#napi_add_finalizer) | | |
|
||||
| | [`node_api_post_finalizer`](api/v18/n-api.html#node_api_post_finalizer) | | |
|
||||
| | | | |
|
||||
| 简单的异步操作 | [`napi_create_async_work`](https://nodejs.cn/api/v18/n-api.html#napi_create_async_work) | | |
|
||||
| | [`napi_delete_async_work`](https://nodejs.cn/api/v18/n-api.html#napi_delete_async_work) | | |
|
||||
| | [`napi_queue_async_work`](https://nodejs.cn/api/v18/n-api.html#napi_queue_async_work) | | |
|
||||
| | [`napi_cancel_async_work`](https://nodejs.cn/api/v18/n-api.html#napi_cancel_async_work) | | |
|
||||
| 简单的异步操作 | [`napi_create_async_work`](api/v18/n-api.html#napi_create_async_work) | | |
|
||||
| | [`napi_delete_async_work`](api/v18/n-api.html#napi_delete_async_work) | | |
|
||||
| | [`napi_queue_async_work`](api/v18/n-api.html#napi_queue_async_work) | | |
|
||||
| | [`napi_cancel_async_work`](api/v18/n-api.html#napi_cancel_async_work) | | |
|
||||
| | | | |
|
||||
| 自定义异步操作 | [`napi_async_init`](https://nodejs.cn/api/v18/n-api.html#napi_async_init) | | |
|
||||
| | [`napi_async_destroy`](https://nodejs.cn/api/v18/n-api.html#napi_async_destroy) | | |
|
||||
| | [`napi_make_callback`](https://nodejs.cn/api/v18/n-api.html#napi_make_callback) | | |
|
||||
| | [`napi_open_callback_scope`](https://nodejs.cn/api/v18/n-api.html#napi_open_callback_scope) | | |
|
||||
| | [`napi_close_callback_scope`](https://nodejs.cn/api/v18/n-api.html#napi_close_callback_scope) | | |
|
||||
| 自定义异步操作 | [`napi_async_init`](api/v18/n-api.html#napi_async_init) | | |
|
||||
| | [`napi_async_destroy`](api/v18/n-api.html#napi_async_destroy) | | |
|
||||
| | [`napi_make_callback`](api/v18/n-api.html#napi_make_callback) | | |
|
||||
| | [`napi_open_callback_scope`](api/v18/n-api.html#napi_open_callback_scope) | | |
|
||||
| | [`napi_close_callback_scope`](api/v18/n-api.html#napi_close_callback_scope) | | |
|
||||
| | | | |
|
||||
| 版本管理 | [`napi_get_node_version`](https://nodejs.cn/api/v18/n-api.html#napi_get_node_version) | | |
|
||||
| | [`napi_get_version`](https://nodejs.cn/api/v18/n-api.html#napi_get_version) | | |
|
||||
| 版本管理 | [`napi_get_node_version`](api/v18/n-api.html#napi_get_node_version) | | |
|
||||
| | [`napi_get_version`](api/v18/n-api.html#napi_get_version) | | |
|
||||
| | | | |
|
||||
| 内存管理 | [`napi_adjust_external_memory`](https://nodejs.cn/api/v18/n-api.html#napi_adjust_external_memory) | | |
|
||||
| 内存管理 | [`napi_adjust_external_memory`](api/v18/n-api.html#napi_adjust_external_memory) | | |
|
||||
| | | | |
|
||||
| Promise | [`napi_create_promise`](https://nodejs.cn/api/v18/n-api.html#napi_create_promise) | | |
|
||||
| | [`napi_resolve_deferred`](https://nodejs.cn/api/v18/n-api.html#napi_resolve_deferred) | | |
|
||||
| | [`napi_reject_deferred`](https://nodejs.cn/api/v18/n-api.html#napi_reject_deferred) | | |
|
||||
| | [`napi_is_promise`](https://nodejs.cn/api/v18/n-api.html#napi_is_promise) | | |
|
||||
| Promise | [`napi_create_promise`](api/v18/n-api.html#napi_create_promise) | | |
|
||||
| | [`napi_resolve_deferred`](api/v18/n-api.html#napi_resolve_deferred) | | |
|
||||
| | [`napi_reject_deferred`](api/v18/n-api.html#napi_reject_deferred) | | |
|
||||
| | [`napi_is_promise`](api/v18/n-api.html#napi_is_promise) | | |
|
||||
| | | | |
|
||||
| 脚本执行 | [`napi_run_script`](https://nodejs.cn/api/v18/n-api.html#napi_run_script) | | |
|
||||
| 脚本执行 | [`napi_run_script`](api/v18/n-api.html#napi_run_script) | | |
|
||||
| | | | |
|
||||
| libuv事件循环 | [`napi_get_uv_event_loop`](https://nodejs.cn/api/v18/n-api.html#napi_get_uv_event_loop) | | |
|
||||
| libuv事件循环 | [`napi_get_uv_event_loop`](api/v18/n-api.html#napi_get_uv_event_loop) | | |
|
||||
| | | | |
|
||||
| 异步线程安全函数调用 | [调用线程安全的函数](https://nodejs.cn/api/v18/n-api.html#调用线程安全的函数) | | |
|
||||
| | [线程安全函数的引用计数](https://nodejs.cn/api/v18/n-api.html#线程安全函数的引用计数) | | |
|
||||
| | [决定是否保持进程运行](https://nodejs.cn/api/v18/n-api.html#决定是否保持进程运行) | | |
|
||||
| | [`napi_create_threadsafe_function`](https://nodejs.cn/api/v18/n-api.html#napi_create_threadsafe_function) | | |
|
||||
| | [`napi_get_threadsafe_function_context`](https://nodejs.cn/api/v18/n-api.html#napi_get_threadsafe_function_context) | | |
|
||||
| | [`napi_call_threadsafe_function`](https://nodejs.cn/api/v18/n-api.html#napi_call_threadsafe_function) | | |
|
||||
| | [`napi_acquire_threadsafe_function`](https://nodejs.cn/api/v18/n-api.html#napi_acquire_threadsafe_function) | | |
|
||||
| | [`napi_ref_threadsafe_function`](https://nodejs.cn/api/v18/n-api.html#napi_ref_threadsafe_function) | | |
|
||||
| | [`napi_unref_threadsafe_function`](https://nodejs.cn/api/v18/n-api.html#napi_unref_threadsafe_function) | | |
|
||||
| 异步线程安全函数调用 | [调用线程安全的函数](api/v18/n-api.html#调用线程安全的函数) | | |
|
||||
| | [线程安全函数的引用计数](api/v18/n-api.html#线程安全函数的引用计数) | | |
|
||||
| | [决定是否保持进程运行](api/v18/n-api.html#决定是否保持进程运行) | | |
|
||||
| | [`napi_create_threadsafe_function`](api/v18/n-api.html#napi_create_threadsafe_function) | | |
|
||||
| | [`napi_get_threadsafe_function_context`](api/v18/n-api.html#napi_get_threadsafe_function_context) | | |
|
||||
| | [`napi_call_threadsafe_function`](api/v18/n-api.html#napi_call_threadsafe_function) | | |
|
||||
| | [`napi_acquire_threadsafe_function`](api/v18/n-api.html#napi_acquire_threadsafe_function) | | |
|
||||
| | [`napi_ref_threadsafe_function`](api/v18/n-api.html#napi_ref_threadsafe_function) | | |
|
||||
| | [`napi_unref_threadsafe_function`](api/v18/n-api.html#napi_unref_threadsafe_function) | | |
|
||||
| | | | |
|
||||
| 其他使用工具 | [`node_api_get_module_file_name`](https://nodejs.cn/api/v18/n-api.html#node_api_get_module_file_name) | | |
|
||||
| 其他使用工具 | [`node_api_get_module_file_name`](api/v18/n-api.html#node_api_get_module_file_name) | | |
|
||||
| | | | |
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"apiType": "stageMode",
|
||||
"buildOption": {
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
|
||||
|
||||
export default {
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"license": "",
|
||||
"devDependencies": {},
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef napitutorials_common.h_H
|
||||
#define napitutorials_common.h_H
|
||||
#ifndef NAPITUTORIALS_COMMON_H
|
||||
#define NAPITUTORIALS_COMMON_H
|
||||
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
@ -78,27 +78,12 @@ template <typename T> void FreeMemoryArray(T *p) {
|
||||
p = nullptr;
|
||||
}
|
||||
#define NAPI_RETVAL_NOTHING
|
||||
#define NAPI_CALL_BASE(env, theCall, retVal) \
|
||||
do { \
|
||||
if ((theCall) != 0) { \
|
||||
\
|
||||
return retVal; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define NAPI_CALL(env, theCall) NAPI_CALL_BASE(env, theCall, nullptr)
|
||||
#define NAPI_CALL_RETURN_VOID(env, theCall) NAPI_CALL_BASE(env, theCall, NAPI_RETVAL_NOTHING)
|
||||
//
|
||||
//extern bool GetMatFromRawFile(napi_env env, napi_value jsResMgr, const std::string &rawfileDir,
|
||||
// const std::string &fileName, cv::Mat &srcImage);
|
||||
//extern bool cvtMat2Pixel(cv::InputArray _src, cv::OutputArray &_dst, int code);
|
||||
//extern napi_value NapiGetNull(napi_env env);
|
||||
//extern uint32_t GetMatDataBuffSize(const cv::Mat &mat);
|
||||
extern bool CreateArrayBuffer(napi_env env, uint8_t *src, size_t srcLen, napi_value *res);
|
||||
extern napi_value NapiGetUndefined(napi_env env);
|
||||
extern napi_value GetCallbackErrorValue(napi_env env, int32_t errCode);
|
||||
extern napi_value NapiGetBoolean(napi_env env, const bool &isValue);
|
||||
//extern uint32_t GetMatDataBuffSize(const cv::Mat &mat);
|
||||
|
||||
extern void SetCallback(const napi_env &env, const napi_ref &callbackIn, const int32_t &errorCode,
|
||||
const napi_value &result);
|
||||
extern void SetPromise(const napi_env &env, const napi_deferred &deferred, const int32_t &errorCode,
|
||||
@ -107,7 +92,6 @@ extern void ReturnCallbackPromise(const napi_env &env, const CallbackPromiseInfo
|
||||
extern napi_value JSParaError(const napi_env &env, const napi_ref &callback);
|
||||
extern void PaddingCallbackPromiseInfo(const napi_env &env, const napi_ref &callback, CallbackPromiseInfo &info,
|
||||
napi_value &promise);
|
||||
//extern bool WrapJsPixelInfoInfo(napi_env env, cv::Mat &outMat, napi_value &result);
|
||||
|
||||
|
||||
#endif //napitutorials_common.h_H
|
||||
#endif //NAPITUTORIALS_COMMON_H
|
||||
|
@ -1,14 +1,23 @@
|
||||
//
|
||||
// Created on 2024/3/15.
|
||||
//
|
||||
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
|
||||
// please include "napi/native_api.h".
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef napitutorials_nodeapi_H
|
||||
#define napitutorials_nodeapi_H
|
||||
#ifndef NAPITUTORIALS_NODEAPI_H
|
||||
#define NAPITUTORIALS_NODEAPI_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
napi_value setInstancedata(napi_env env, napi_value exports);
|
||||
|
||||
#endif //napitutorials_nodeapi_H
|
||||
#endif //NAPITUTORIALS_NODEAPI_H
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "napi/native_api.h"
|
||||
#include <bits/alltypes.h>
|
||||
#include "nodeapi.h"
|
||||
|
@ -1,32 +1,41 @@
|
||||
//
|
||||
// Created on 2024/3/15.
|
||||
//
|
||||
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
|
||||
// please include "napi/native_api.h".
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
static const char *TAG = "[nodeapi_instancedata]";
|
||||
|
||||
// 设置要关联的自定义数据
|
||||
// warning: 'napi_set_instance_data' is deprecated [-Wdeprecated-declarations]
|
||||
// ld.lld: error: undefined symbol: napi_set_instance_data
|
||||
// int *myData = new int(42);
|
||||
// napi_set_instance_data(env, myData,
|
||||
// [](napi_env env, void *data, void *hint) {
|
||||
// // 释放自定义数据内存
|
||||
// delete static_cast<int *>(data);
|
||||
// },
|
||||
// nullptr);
|
||||
#define TEST_INT32 315
|
||||
napi_value setInstancedata(napi_env env, napi_value exports) {
|
||||
// pages/nodeapi/envlifecycleapis/napisetinstancedata
|
||||
napi_value instance;
|
||||
napi_create_object(env, &instance);
|
||||
napi_value testint32 = nullptr;
|
||||
napi_create_int32(env, 315, &testint32);
|
||||
napi_create_int32(env, TEST_INT32, &testint32);
|
||||
napi_set_named_property(env, instance, "testint32", testint32);
|
||||
|
||||
// 设置要关联的自定义数据
|
||||
// warning: 'napi_set_instance_data' is deprecated [-Wdeprecated-declarations]
|
||||
// ld.lld: error: undefined symbol: napi_set_instance_data
|
||||
// int *myData = new int(42);
|
||||
// napi_set_instance_data(env, myData,
|
||||
// [](napi_env env, void *data, void *hint) {
|
||||
// // 释放自定义数据内存
|
||||
// delete static_cast<int *>(data);
|
||||
// },
|
||||
// nullptr);
|
||||
|
||||
// 导出 N-API 实例对象
|
||||
napi_set_named_property(env, exports, "instance", instance);
|
||||
return instance;
|
||||
|
@ -1,3 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export interface InstanceData {
|
||||
testint32: number;
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"name": "libentry.so",
|
||||
"types": "./index.d.ts",
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
|
||||
import hilog from '@ohos.hilog';
|
||||
import UIAbility from '@ohos.app.ability.UIAbility';
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import hilog from '@ohos.hilog';
|
||||
import testNapi from 'libentry.so';
|
||||
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"module": {
|
||||
"name": "entry",
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"module": {
|
||||
"name": "entry_test",
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"hvigorVersion": "3.0.9",
|
||||
"dependencies": {
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,3 +1,18 @@
|
||||
#
|
||||
# Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"license": "",
|
||||
"devDependencies": {
|
||||
|
Loading…
Reference in New Issue
Block a user