11cb0ef41Sopenharmony_ci#include <node_api.h> 21cb0ef41Sopenharmony_ci#include "../../js-native-api/common.h" 31cb0ef41Sopenharmony_ci#include <string.h> 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_cistatic napi_value Method(napi_env env, napi_callback_info info) { 61cb0ef41Sopenharmony_ci napi_value world; 71cb0ef41Sopenharmony_ci const char* str = "world"; 81cb0ef41Sopenharmony_ci size_t str_len = strlen(str); 91cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_create_string_utf8(env, str, str_len, &world)); 101cb0ef41Sopenharmony_ci return world; 111cb0ef41Sopenharmony_ci} 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciNAPI_MODULE_INIT() { 141cb0ef41Sopenharmony_ci napi_property_descriptor desc = DECLARE_NODE_API_PROPERTY("hello", Method); 151cb0ef41Sopenharmony_ci NODE_API_CALL(env, napi_define_properties(env, exports, 1, &desc)); 161cb0ef41Sopenharmony_ci return exports; 171cb0ef41Sopenharmony_ci} 18