Skip to content
Permalink
Browse files

doc: fix out of date napi_callback doc

The earlier version `napi_callback` returns `void` but now is
`napi_value`. The document of this section hasn't been modified.

PR-URL: #13570
Fixes: #12248
Fixes: #13562
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
XadillaX authored and addaleax committed Jun 9, 2017
1 parent e7c0088 commit db82eef473497dee5bc36daa905eb4cb3d63afdf
Showing with 6 additions and 7 deletions.
  1. +6 −7 doc/api/n-api.md
@@ -161,18 +161,16 @@ For more details, review the [Object Lifetime Management][].

### N-API Callback types
#### *napi_callback_info*
Opaque datatype that is passed to a callback function. It can be used for two
purposes:
- Get additional information about the context in which the callback was
invoked.
- Set the return value of the callback.
Opaque datatype that is passed to a callback function. It can be used for
getting additional information about the context in which the callback was
invoked.

#### *napi_callback*
Function pointer type for user-provided native functions which are to be
exposed to JavaScript via N-API. Callback functions should satisfy the
following signature:
```C
typedef void (*napi_callback)(napi_env, napi_callback_info);
typedef napi_value (*napi_callback)(napi_env, napi_callback_info);
```
#### *napi_finalize*
@@ -2516,8 +2514,9 @@ In order to expose a function as part of the
add-on's module exports, set the newly created function on the exports
object. A sample module might look as follows:
```C
void SayHello(napi_env env, napi_callback_info info) {
napi_value SayHello(napi_env env, napi_callback_info info) {
printf("Hello\n");
return nullptr;
}
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {

0 comments on commit db82eef

Please sign in to comment.
You can’t perform that action at this time.