From db7853bc4ded60076e756990d086d4e1df6446ac Mon Sep 17 00:00:00 2001 From: chenlincl3 <932565568@qq.com> Date: Wed, 6 Mar 2024 20:03:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Enapi=5Fload=5Fmodule=5Fwith?= =?UTF-8?q?=5Finfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenlincl3 Change-Id: Ic90abbde2b64535bb522895e685d41c6ef65f5c0 --- arkui/napi/libnapi.ndk.json | 4 ++++ arkui/napi/native_api.h | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/arkui/napi/libnapi.ndk.json b/arkui/napi/libnapi.ndk.json index f541fdd9aac..e91f4dd656e 100644 --- a/arkui/napi/libnapi.ndk.json +++ b/arkui/napi/libnapi.ndk.json @@ -154,5 +154,9 @@ { "first_introduced": "11", "name": "napi_make_callback" + }, + { + "first_introduced": "12", + "name": "napi_load_module_with_info" } ] diff --git a/arkui/napi/native_api.h b/arkui/napi/native_api.h index 6b20b1c6e39..024f16a5998 100644 --- a/arkui/napi/native_api.h +++ b/arkui/napi/native_api.h @@ -78,6 +78,21 @@ typedef napi_value (*napi_native_binding_attach_callback)(napi_env env, void* na NAPI_EXTERN napi_status napi_run_script_path(napi_env env, const char* path, napi_value* result); NAPI_EXTERN napi_status napi_queue_async_work_with_qos(napi_env env, napi_async_work work, napi_qos_t qos); NAPI_EXTERN napi_status napi_load_module(napi_env env, const char* path, napi_value* result); + +/** + * @brief The module is loaded through the NAPI. By default, the default object is exported from the module. + * + * @param env Current running virtual machine context. + * @param path Path name of the module to be loaded, like @ohos.hilog. + * @param module_info Path names of bundle and module, like com.example.application/entry. + * @param result Result of loading a module, which is an exported object of the module. + * @return Returns the function execution status. + * @since 12 +*/ +NAPI_EXTERN napi_status napi_load_module_with_info(napi_env env, + const char* path, + const char* module_info, + napi_value* result); NAPI_EXTERN napi_status napi_get_instance_data(napi_env env, void** data); NAPI_EXTERN napi_status napi_set_instance_data(napi_env env, void* data, -- Gitee