@@ -222,6 +222,10 @@ consumed by the various APIs. These APIs should be treated as opaque,
222
222
introspectable only with other N-API calls.
223
223
224
224
### napi_status
225
+ <!-- YAML
226
+ added: v8.0.0
227
+ napiVersion: 1
228
+ -->
225
229
Integral status code indicating the success or failure of a N-API call.
226
230
Currently, the following status codes are supported.
227
231
```C
@@ -251,6 +255,10 @@ If additional information is required upon an API returning a failed status,
251
255
it can be obtained by calling `napi_get_last_error_info`.
252
256
253
257
### napi_extended_error_info
258
+ <!-- YAML
259
+ added: v8.0.0
260
+ napiVersion: 1
261
+ -->
254
262
```C
255
263
typedef struct {
256
264
const char* error_message;
@@ -283,12 +291,20 @@ not allowed.
283
291
This is an opaque pointer that is used to represent a JavaScript value.
284
292
285
293
### napi_threadsafe_function
294
+ <!-- YAML
295
+ added: v10.6.0
296
+ napiVersion: 4
297
+ -->
286
298
287
299
This is an opaque pointer that represents a JavaScript function which can be
288
300
called asynchronously from multiple threads via
289
301
`napi_call_threadsafe_function()`.
290
302
291
303
### napi_threadsafe_function_release_mode
304
+ <!-- YAML
305
+ added: v10.6.0
306
+ napiVersion: 4
307
+ -->
292
308
293
309
A value to be given to `napi_release_threadsafe_function()` to indicate whether
294
310
the thread-safe function is to be closed immediately (`napi_tsfn_abort`) or
@@ -302,6 +318,10 @@ typedef enum {
302
318
```
303
319
304
320
### napi_threadsafe_function_call_mode
321
+ <!-- YAML
322
+ added: v10.6.0
323
+ napiVersion: 4
324
+ -->
305
325
306
326
A value to be given to `napi_call_threadsafe_function()` to indicate whether
307
327
the call should block whenever the queue associated with the thread-safe
@@ -333,10 +353,18 @@ longer referenced from the current stack frame.
333
353
For more details, review the [Object Lifetime Management][].
334
354
335
355
#### napi_escapable_handle_scope
356
+ <!-- YAML
357
+ added: v8.0.0
358
+ napiVersion: 1
359
+ -->
336
360
Escapable handle scopes are a special type of handle scope to return values
337
361
created within a particular handle scope to a parent scope.
338
362
339
363
#### napi_ref
364
+ <!-- YAML
365
+ added: v8.0.0
366
+ napiVersion: 1
367
+ -->
340
368
This is the abstraction to use to reference a `napi_value`. This allows for
341
369
users to manage the lifetimes of JavaScript values, including defining their
342
370
minimum lifetimes explicitly.
@@ -345,11 +373,19 @@ For more details, review the [Object Lifetime Management][].
345
373
346
374
### N-API Callback types
347
375
#### napi_callback_info
376
+ <!-- YAML
377
+ added: v8.0.0
378
+ napiVersion: 1
379
+ -->
348
380
Opaque datatype that is passed to a callback function. It can be used for
349
381
getting additional information about the context in which the callback was
350
382
invoked.
351
383
352
384
#### napi_callback
385
+ <!-- YAML
386
+ added: v8.0.0
387
+ napiVersion: 1
388
+ -->
353
389
Function pointer type for user-provided native functions which are to be
354
390
exposed to JavaScript via N-API. Callback functions should satisfy the
355
391
following signature:
@@ -358,6 +394,10 @@ typedef napi_value (*napi_callback)(napi_env, napi_callback_info);
358
394
```
359
395
360
396
#### napi_finalize
397
+ <!-- YAML
398
+ added: v8.0.0
399
+ napiVersion: 1
400
+ -->
361
401
Function pointer type for add-on provided functions that allow the user to be
362
402
notified when externally-owned data is ready to be cleaned up because the
363
403
object with which it was associated with, has been garbage-collected. The user
@@ -372,6 +412,10 @@ typedef void (*napi_finalize)(napi_env env,
372
412
```
373
413
374
414
#### napi_async_execute_callback
415
+ <!-- YAML
416
+ added: v8.0.0
417
+ napiVersion: 1
418
+ -->
375
419
Function pointer used with functions that support asynchronous
376
420
operations. Callback functions must satisfy the following signature:
377
421
@@ -385,6 +429,10 @@ JavaScript objects. Most often, any code that needs to make N-API
385
429
calls should be made in `napi_async_complete_callback` instead.
386
430
387
431
#### napi_async_complete_callback
432
+ <!-- YAML
433
+ added: v8.0.0
434
+ napiVersion: 1
435
+ -->
388
436
Function pointer used with functions that support asynchronous
389
437
operations. Callback functions must satisfy the following signature:
390
438
@@ -395,6 +443,10 @@ typedef void (*napi_async_complete_callback)(napi_env env,
395
443
```
396
444
397
445
#### napi_threadsafe_function_call_js
446
+ <!-- YAML
447
+ added: v10.6.0
448
+ napiVersion: 4
449
+ -->
398
450
399
451
Function pointer used with asynchronous thread-safe function calls. The callback
400
452
will be called on the main thread. Its purpose is to use a data item arriving
@@ -460,6 +512,10 @@ In order to retrieve this information [`napi_get_last_error_info`][]
460
512
is provided which returns a `napi_extended_error_info` structure.
461
513
The format of the `napi_extended_error_info` structure is as follows:
462
514
515
+ <!-- YAML
516
+ added: v10.6.0
517
+ napiVersion: 4
518
+ -->
463
519
```C
464
520
typedef struct napi_extended_error_info {
465
521
const char* error_message;
0 commit comments