mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-19 01:59:48 +00:00
24 lines
No EOL
626 B
C
24 lines
No EOL
626 B
C
#include <node_api.h>
|
|
|
|
napi_value Method(napi_env env, napi_callback_info args) {
|
|
napi_value greeting;
|
|
napi_status status;
|
|
|
|
status = napi_create_string_utf8(env, "World!", NAPI_AUTO_LENGTH, &greeting);
|
|
if (status != napi_ok) return NULL;
|
|
return greeting;
|
|
}
|
|
|
|
napi_value init(napi_env env, napi_value exports) {
|
|
napi_status status;
|
|
napi_value fn;
|
|
|
|
status = napi_create_function(env, NULL, 0, Method, NULL, &fn);
|
|
if (status != napi_ok) return NULL;
|
|
|
|
status = napi_set_named_property(env, exports, "hello", fn);
|
|
if (status != napi_ok) return NULL;
|
|
return exports;
|
|
}
|
|
|
|
NAPI_MODULE(NODE_GYP_MODULE_NAME, init) |