mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
09d41e22cc
The doc/api/addons.md document contains examples of Addon Initialization functions that take a parameter named exports. This also matches the name used in node.cc when calling: mp->nm_register_func(exports, module, mp->nm_priv); Currently, a number of the tests name this same parameter target. This commit renames target to exports for consistency. PR-URL: https://github.com/nodejs/node/pull/9135 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
15 lines
370 B
C++
15 lines
370 B
C++
#include <node.h>
|
|
#include <v8.h>
|
|
|
|
void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|
v8::Isolate* isolate = args.GetIsolate();
|
|
v8::HandleScope scope(isolate);
|
|
args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world"));
|
|
}
|
|
|
|
void init(v8::Local<v8::Object> exports) {
|
|
NODE_SET_METHOD(exports, "hello", Method);
|
|
}
|
|
|
|
NODE_MODULE(binding, init);
|