summaryrefslogtreecommitdiff
path: root/doc/api/n-api.md
diff options
context:
space:
mode:
authorGabriel Schulhof <gabriel.schulhof@intel.com>2017-09-05 23:53:06 +0300
committerGabriel Schulhof <gabriel.schulhof@intel.com>2017-09-10 00:15:49 +0300
commit78286984da50ed7f0ed8914b587da62c552277ce (patch)
tree8c690095a5c947a2b62796b8ff0828d5a62727d3 /doc/api/n-api.md
parenta2b68723a920b9cc70377727ec0e3bbe11fbe548 (diff)
downloadandroid-node-v8-78286984da50ed7f0ed8914b587da62c552277ce.tar.gz
android-node-v8-78286984da50ed7f0ed8914b587da62c552277ce.tar.bz2
android-node-v8-78286984da50ed7f0ed8914b587da62c552277ce.zip
test,doc: make module name match gyp target name
Currently the nm_modname does not match the file name of the resulting module. In fact, the nm_modname is pretty arbitrary. This seeks to introduce some consistency into the nm_modname property by having the name of the module appear in exactly one place: the "target_name" property of the gyp target that builds the module. PR-URL: https://github.com/nodejs/node/pull/15209 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r--doc/api/n-api.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index 3a3cce0364..6269259260 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -877,7 +877,7 @@ except that instead of using the `NODE_MODULE` macro the following
is used:
```C
-NAPI_MODULE(addon, Init)
+NAPI_MODULE(NODE_GYP_MODULE_NAME, Init)
```
The next difference is the signature for the `Init` method. For a N-API
@@ -2874,7 +2874,7 @@ void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
if (status != napi_ok) return;
}
-NAPI_MODULE(addon, Init)
+NAPI_MODULE(NODE_GYP_MODULE_NAME, Init)
```
Given the above code, the add-on can be used from JavaScript as follows: