We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0590fba commit 7ca7b6dCopy full SHA for 7ca7b6d
1 file changed
build_with_cmake/node-addon-api/hello.cc
@@ -1,8 +1,16 @@
1
#include <napi.h>
2
3
+
4
static Napi::String Method(const Napi::CallbackInfo& info) {
5
+ // Napi::Env is the opaque data structure containing the environment in which the request is being run.
6
+ // We will need this env when we want to create any new objects inside of the node.js environment
7
Napi::Env env = info.Env();
- return Napi::String::New(env, "Hello, world!");
8
9
+ // Create a C++ level variable
10
+ std::string helloWorld = "Hello, world!";
11
12
+ // Return a new javascript string that we copy-construct inside of the node.js environment
13
+ return Napi::String::New(env, helloWorld);
14
}
15
16
static Napi::Object Init(Napi::Env env, Napi::Object exports) {
0 commit comments