Skip to content

Commit 286979e

Browse files
committedJun 9, 2017
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. Fixes: nodejs#12248
1 parent 8208fda commit 286979e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

Diff for: ‎doc/api/n-api.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Function pointer type for user-provided native functions which are to be
172172
exposed to JavaScript via N-API. Callback functions should satisfy the
173173
following signature:
174174
```C
175-
typedef void (*napi_callback)(napi_env, napi_callback_info);
175+
typedef napi_value (*napi_callback)(napi_env, napi_callback_info);
176176
```
177177
178178
#### *napi_finalize*
@@ -2521,8 +2521,9 @@ In order to expose a function as part of the
25212521
add-on's module exports, set the newly created function on the exports
25222522
object. A sample module might look as follows:
25232523
```C
2524-
void SayHello(napi_env env, napi_callback_info info) {
2524+
napi_value SayHello(napi_env env, napi_callback_info info) {
25252525
printf("Hello\n");
2526+
return nullptr;
25262527
}
25272528
25282529
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {

0 commit comments

Comments
 (0)