File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -161,18 +161,16 @@ For more details, review the [Object Lifetime Management][].
161
161
162
162
### N-API Callback types
163
163
#### * napi_callback_info*
164
- Opaque datatype that is passed to a callback function. It can be used for two
165
- purposes:
166
- - Get additional information about the context in which the callback was
167
- invoked.
168
- - Set the return value of the callback.
164
+ Opaque datatype that is passed to a callback function. It can be used for
165
+ getting additional information about the context in which the callback was
166
+ invoked.
169
167
170
168
#### * napi_callback*
171
169
Function pointer type for user-provided native functions which are to be
172
170
exposed to JavaScript via N-API. Callback functions should satisfy the
173
171
following signature:
174
172
``` C
175
- typedef void (* napi_callback)(napi_env, napi_callback_info);
173
+ typedef napi_value (* napi_callback)(napi_env, napi_callback_info);
176
174
```
177
175
178
176
#### *napi_finalize*
@@ -2516,8 +2514,9 @@ In order to expose a function as part of the
2516
2514
add-on's module exports, set the newly created function on the exports
2517
2515
object. A sample module might look as follows:
2518
2516
```C
2519
- void SayHello(napi_env env, napi_callback_info info) {
2517
+ napi_value SayHello(napi_env env, napi_callback_info info) {
2520
2518
printf("Hello\n");
2519
+ return nullptr;
2521
2520
}
2522
2521
2523
2522
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
You can’t perform that action at this time.
0 commit comments