Node-API FAQs
Stability
- How do I troubleshoot the issue that an application often crashes during running?
- How to handle thread safety issues when the ArkTS method is concurrently called in the thread pool?
- What should I do if the content of napi_value changes?
- Is there a method to obtain the latest napi_env?
- What should I do if napi_add_env_cleanup_hook is called incorrectly?
Memory Leak
- Is there any mechanism to check whether napi_ref leaks?
- How do I locate and resolve memory leaks during Node-API development?
- For details about parameter leaks, see napi_open_handle_scope and napi_close_handle_scope.
- What should I do if memory leaks when napi_threadsafe_function is used?
Basic Functionalities
- What should I do if the module fails to be loaded and the error message "Error message: is not callable" is displayed?
- How to ensure the order of asynchronous tasks in scenarios where a large number of ArkTS methods need to be called for communication?
- Is there a convenient way to call back ArkTS?
- How do I invoke a function transferred from ArkTS in a C++ subthread?
- How to ensure the correct mapping of data types and the security of memory management?
- Integrating a Third-Party Dynamic Link Library
- What are the error codes of the napi_get_uv_event_loop API?
- Must a function be passed to the native layer when the native layer calls the object method of the ArkTS layer?
- Can I call an ArkTS method and obtain the result?
- Whether there is a napi_get_value_string_utf8 API or capability that does not need the copy operation?
- What are the precautions for using napi_env in multi-thread mode?
- What should I do if the napi_call_threadsafe_function execution sequence does not meet the expectation?
- What should I do if an error message "undefined" is displayed on the ArkTS side?
- What should I do if the API execution result is unexpected?
- What are the differences between the lifecycle of napi_value and napi_ref?
- How do I locate the fault if the return value of a Node-API is not "napi_ok"?
- How do I ensure that objects wrapped by napi_wrap are destructed in the expected order?
- What should I do if the napi_call_threadsafe_function callback task is not executed?