diff --git a/arkui/napi/libnapi.ndk.json b/arkui/napi/libnapi.ndk.json index 04e3cc6d4824ab762c9ae1baddff5036dff0d61b..5bdd52c3319ed72b1336febe33d107efccf6a98d 100644 --- a/arkui/napi/libnapi.ndk.json +++ b/arkui/napi/libnapi.ndk.json @@ -242,5 +242,17 @@ { "first_introduced": "18", "name": "napi_wrap_enhance" + }, + { + "first_introduced": "20", + "name": "napi_create_ark_context" + }, + { + "first_introduced": "20", + "name": "napi_switch_ark_context" + }, + { + "first_introduced": "20", + "name": "napi_destroy_ark_context" } ] diff --git a/arkui/napi/native_api.h b/arkui/napi/native_api.h index c1dd962f8acbcc1955df6dfd7c64abaf9a727415..d1dc1c45c882003315bf1882a8f288f42ba8ddfe 100644 --- a/arkui/napi/native_api.h +++ b/arkui/napi/native_api.h @@ -1639,6 +1639,43 @@ NAPI_EXTERN napi_status napi_define_class(napi_env env, size_t property_count, const napi_property_descriptor* properties, napi_value* result); + +/** + * @brief To create a new virtual machine context. + * @param env Current running virtual machine context. + * @param newEnv New generated virtual machine context which is expected to be used later. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If the param env is nullptr.\n + * {@link napi_pending_exception } If have uncaught exception, or exception occurs in execution.\n + * @since 20 + */ +NAPI_EXTERN napi_status napi_create_ark_context(napi_env env, napi_env *newEnv); + +/** + * @brief To switch a virtual machine context which is expected to be used later. + * @param env Designated Virtual machine context which is expected to be used as the current virtual machine context. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If the param env is nullptr.\n + * {@link napi_pending_exception } If have uncaught exception, or exception occurs in execution.\n + * @since 20 + */ +NAPI_EXTERN napi_status napi_switch_ark_context(napi_env env); + +/** + * @brief To destroy a virtual machine context which will not be used again. + * @param env Virtual machine context expected to be destroyed. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If the param env is nullptr.\n + * {@link napi_pending_exception } If have uncaught exception, or exception occurs in execution.\n + * @since 20 + */ +NAPI_EXTERN napi_status napi_destroy_ark_context(napi_env env); #ifdef __cplusplus } #endif