diff --git a/arkui/napi/libnapi.ndk.json b/arkui/napi/libnapi.ndk.json index f541fdd9aac6950512087acdaa126bb3b9b373ea..d9d055527dcbfefeba2de2b36e646493a7bba066 100644 --- a/arkui/napi/libnapi.ndk.json +++ b/arkui/napi/libnapi.ndk.json @@ -154,5 +154,13 @@ { "first_introduced": "11", "name": "napi_make_callback" + }, + { + "first_introduced": "12", + "name": "napi_create_ark_runtime" + }, + { + "first_introduced": "12", + "name": "napi_destroy_ark_runtime" } ] diff --git a/arkui/napi/native_api.h b/arkui/napi/native_api.h index 6b20b1c6e39c53fa04bec3b78d804e3fb8a46a46..6aa257d185146f4cb38cd5b7dfe6061f762c0b68 100644 --- a/arkui/napi/native_api.h +++ b/arkui/napi/native_api.h @@ -127,6 +127,21 @@ NAPI_EXTERN napi_status napi_add_finalizer(napi_env env, napi_finalize finalize_cb, void* finalize_hint, napi_ref* result); +/** + * @brief Create the ark runtime. + * + * @param env Indicates the ark runtime environment. + * @since 12 + */ +NAPI_EXTERN napi_status napi_create_ark_runtime(napi_env* env); + +/** + * @brief Destroy the ark runtime. + * + * @param env Indicates the ark runtime environment. + * @since 12 + */ +NAPI_EXTERN napi_status napi_destroy_ark_runtime(napi_env* env); #ifdef __cplusplus } diff --git a/third_party/node/src/js_native_api_types.h b/third_party/node/src/js_native_api_types.h index 6aba06629b31543c13698dbb02b82db309587c4a..74dc6d148e3d7bffa7dc93dbee271963d812e2fd 100644 --- a/third_party/node/src/js_native_api_types.h +++ b/third_party/node/src/js_native_api_types.h @@ -92,7 +92,13 @@ typedef enum { napi_date_expected, napi_arraybuffer_expected, napi_detachable_arraybuffer_expected, - napi_would_deadlock // unused + napi_would_deadlock, // unused + // Created too many ark runtime environment, up to 16. + napi_create_ark_runtime_too_many_envs = 22, + // Only one ark runtime environment can be created per thread. + napi_create_ark_runtime_only_one_env_per_thread = 23, + // The ark runtime environment to be destroyed does not exist. + napi_destroy_ark_runtime_env_not_exist = 24 } napi_status; // Note: when adding a new enum value to `napi_status`, please also update // * `const int last_status` in the definition of `napi_get_last_error_info()'