summaryrefslogtreecommitdiff
path: root/doc/api/n-api.md
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2019-09-13 00:22:29 -0400
committerRich Trott <rtrott@gmail.com>2019-09-16 11:24:54 -0700
commite2dcbf1c3231513c38151d729f180a54ea902da9 (patch)
tree1f9197fb7c0af601c310a179ba089fdac8d6d5b5 /doc/api/n-api.md
parent3d841fe20d732111094c3f62febd5a6b8b483b91 (diff)
downloadandroid-node-v8-e2dcbf1c3231513c38151d729f180a54ea902da9.tar.gz
android-node-v8-e2dcbf1c3231513c38151d729f180a54ea902da9.tar.bz2
android-node-v8-e2dcbf1c3231513c38151d729f180a54ea902da9.zip
doc: use consistent unordered list style
Convert to asterisks when there are mixed styles in document. Addresses Markdownlint MD004 rule PR-URL: https://github.com/nodejs/node/pull/29516 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r--doc/api/n-api.md1028
1 files changed, 514 insertions, 514 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index 8f4eac2957..241c50fc4d 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -25,12 +25,12 @@ JavaScript values. Concepts and operations generally map to ideas specified
in the ECMA-262 Language Specification. The APIs have the following
properties:
-- All N-API calls return a status code of type `napi_status`. This
+* All N-API calls return a status code of type `napi_status`. This
status indicates whether the API call succeeded or failed.
-- The API's return value is passed via an out parameter.
-- All JavaScript values are abstracted behind an opaque type named
+* The API's return value is passed via an out parameter.
+* All JavaScript values are abstracted behind an opaque type named
`napi_value`.
-- In case of an error status code, additional information can be obtained
+* In case of an error status code, additional information can be obtained
using `napi_get_last_error_info`. More information can be found in the error
handling section [Error Handling][].
@@ -302,11 +302,11 @@ napi_status napi_set_instance_data(napi_env env,
void* finalize_hint);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] data`: The data item to make available to bindings of this instance.
-- `[in] finalize_cb`: The function to call when the environment is being torn
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] data`: The data item to make available to bindings of this instance.
+* `[in] finalize_cb`: The function to call when the environment is being torn
down. The function receives `data` so that it might free it.
-- `[in] finalize_hint`: Optional hint to pass to the finalize callback
+* `[in] finalize_hint`: Optional hint to pass to the finalize callback
during collection.
Returns `napi_ok` if the API succeeded.
@@ -327,8 +327,8 @@ napi_status napi_get_instance_data(napi_env env,
void** data);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[out] data`: The data item that was previously associated with the currently
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[out] data`: The data item that was previously associated with the currently
running Agent by a call to `napi_set_instance_data()`.
Returns `napi_ok` if the API succeeded.
@@ -393,13 +393,13 @@ typedef struct {
} napi_extended_error_info;
```
-- `error_message`: UTF8-encoded string containing a VM-neutral description of
+* `error_message`: UTF8-encoded string containing a VM-neutral description of
the error.
-- `engine_reserved`: Reserved for VM-specific error details. This is currently
+* `engine_reserved`: Reserved for VM-specific error details. This is currently
not implemented for any VM.
-- `engine_error_code`: VM-specific error code. This is currently
+* `engine_error_code`: VM-specific error code. This is currently
not implemented for any VM.
-- `error_code`: The N-API status code that originated with the last error.
+* `error_code`: The N-API status code that originated with the last error.
See the [Error Handling][] section for additional information.
@@ -601,14 +601,14 @@ typedef void (*napi_threadsafe_function_call_js)(napi_env env,
void* data);
```
-- `[in] env`: The environment to use for API calls, or `NULL` if the thread-safe
+* `[in] env`: The environment to use for API calls, or `NULL` if the thread-safe
function is being torn down and `data` may need to be freed.
-- `[in] js_callback`: The JavaScript function to call, or `NULL` if the
+* `[in] js_callback`: The JavaScript function to call, or `NULL` if the
thread-safe function is being torn down and `data` may need to be freed. It may
also be `NULL` if the thread-safe function was created without `js_callback`.
-- `[in] context`: The optional data with which the thread-safe function was
+* `[in] context`: The optional data with which the thread-safe function was
created.
-- `[in] data`: Data created by the secondary thread. It is the responsibility of
+* `[in] data`: Data created by the secondary thread. It is the responsibility of
the callback to convert this native data to JavaScript values (with N-API
functions) that can be passed as parameters when `js_callback` is invoked. This
pointer is managed entirely by the threads and this callback. Thus this callback
@@ -659,10 +659,10 @@ typedef struct napi_extended_error_info {
};
```
-- `error_message`: Textual representation of the error that occurred.
-- `engine_reserved`: Opaque handle reserved for engine use only.
-- `engine_error_code`: VM specific error code.
-- `error_code`: n-api status code for the last error.
+* `error_message`: Textual representation of the error that occurred.
+* `engine_reserved`: Opaque handle reserved for engine use only.
+* `engine_error_code`: VM specific error code.
+* `error_code`: n-api status code for the last error.
[`napi_get_last_error_info`][] returns the information for the last
N-API call that was made.
@@ -683,8 +683,8 @@ napi_get_last_error_info(napi_env env,
const napi_extended_error_info** result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: The `napi_extended_error_info` structure with more
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: The `napi_extended_error_info` structure with more
information about the error.
Returns `napi_ok` if the API succeeded.
@@ -791,8 +791,8 @@ napiVersion: 1
NAPI_EXTERN napi_status napi_throw(napi_env env, napi_value error);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] error`: The JavaScript value to be thrown.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] error`: The JavaScript value to be thrown.
Returns `napi_ok` if the API succeeded.
@@ -810,9 +810,9 @@ NAPI_EXTERN napi_status napi_throw_error(napi_env env,
const char* msg);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] code`: Optional error code to be set on the error.
-- `[in] msg`: C string representing the text to be associated with
+* `[in] env`: The environment that the API is invoked under.
+* `[in] code`: Optional error code to be set on the error.
+* `[in] msg`: C string representing the text to be associated with
the error.
Returns `napi_ok` if the API succeeded.
@@ -831,9 +831,9 @@ NAPI_EXTERN napi_status napi_throw_type_error(napi_env env,
const char* msg);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] code`: Optional error code to be set on the error.
-- `[in] msg`: C string representing the text to be associated with
+* `[in] env`: The environment that the API is invoked under.
+* `[in] code`: Optional error code to be set on the error.
+* `[in] msg`: C string representing the text to be associated with
the error.
Returns `napi_ok` if the API succeeded.
@@ -852,9 +852,9 @@ NAPI_EXTERN napi_status napi_throw_range_error(napi_env env,
const char* msg);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] code`: Optional error code to be set on the error.
-- `[in] msg`: C string representing the text to be associated with
+* `[in] env`: The environment that the API is invoked under.
+* `[in] code`: Optional error code to be set on the error.
+* `[in] msg`: C string representing the text to be associated with
the error.
Returns `napi_ok` if the API succeeded.
@@ -873,9 +873,9 @@ NAPI_EXTERN napi_status napi_is_error(napi_env env,
bool* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The `napi_value` to be checked.
-- `[out] result`: Boolean value that is set to true if `napi_value` represents
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The `napi_value` to be checked.
+* `[out] result`: Boolean value that is set to true if `napi_value` represents
an error, false otherwise.
Returns `napi_ok` if the API succeeded.
@@ -895,12 +895,12 @@ NAPI_EXTERN napi_status napi_create_error(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] code`: Optional `napi_value` with the string for the error code to
+* `[in] env`: The environment that the API is invoked under.
+* `[in] code`: Optional `napi_value` with the string for the error code to
be associated with the error.
-- `[in] msg`: `napi_value` that references a JavaScript `String` to be
+* `[in] msg`: `napi_value` that references a JavaScript `String` to be
used as the message for the `Error`.
-- `[out] result`: `napi_value` representing the error created.
+* `[out] result`: `napi_value` representing the error created.
Returns `napi_ok` if the API succeeded.
@@ -919,12 +919,12 @@ NAPI_EXTERN napi_status napi_create_type_error(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] code`: Optional `napi_value` with the string for the error code to
+* `[in] env`: The environment that the API is invoked under.
+* `[in] code`: Optional `napi_value` with the string for the error code to
be associated with the error.
-- `[in] msg`: `napi_value` that references a JavaScript `String` to be
+* `[in] msg`: `napi_value` that references a JavaScript `String` to be
used as the message for the `Error`.
-- `[out] result`: `napi_value` representing the error created.
+* `[out] result`: `napi_value` representing the error created.
Returns `napi_ok` if the API succeeded.
@@ -943,12 +943,12 @@ NAPI_EXTERN napi_status napi_create_range_error(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] code`: Optional `napi_value` with the string for the error code to
+* `[in] env`: The environment that the API is invoked under.
+* `[in] code`: Optional `napi_value` with the string for the error code to
be associated with the error.
-- `[in] msg`: `napi_value` that references a JavaScript `String` to be
+* `[in] msg`: `napi_value` that references a JavaScript `String` to be
used as the message for the `Error`.
-- `[out] result`: `napi_value` representing the error created.
+* `[out] result`: `napi_value` representing the error created.
Returns `napi_ok` if the API succeeded.
@@ -965,8 +965,8 @@ napi_status napi_get_and_clear_last_exception(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: The exception if one is pending, NULL otherwise.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: The exception if one is pending, NULL otherwise.
Returns `napi_ok` if the API succeeded.
@@ -984,8 +984,8 @@ napiVersion: 1
napi_status napi_is_exception_pending(napi_env env, bool* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: Boolean value that is set to true if an exception is pending.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: Boolean value that is set to true if an exception is pending.
Returns `napi_ok` if the API succeeded.
@@ -1003,8 +1003,8 @@ napiVersion: 3
napi_status napi_fatal_exception(napi_env env, napi_value err);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] err`: The error that is passed to `'uncaughtException'`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] err`: The error that is passed to `'uncaughtException'`.
Trigger an `'uncaughtException'` in JavaScript. Useful if an async
callback throws an exception with no way to recover.
@@ -1027,11 +1027,11 @@ NAPI_NO_RETURN void napi_fatal_error(const char* location,
size_t message_len);
```
-- `[in] location`: Optional location at which the error occurred.
-- `[in] location_len`: The length of the location in bytes, or
+* `[in] location`: Optional location at which the error occurred.
+* `[in] location_len`: The length of the location in bytes, or
`NAPI_AUTO_LENGTH` if it is null-terminated.
-- `[in] message`: The message associated with the error.
-- `[in] message_len`: The length of the message in bytes, or
+* `[in] message`: The message associated with the error.
+* `[in] message_len`: The length of the message in bytes, or
`NAPI_AUTO_LENGTH` if it is
null-terminated.
@@ -1140,8 +1140,8 @@ NAPI_EXTERN napi_status napi_open_handle_scope(napi_env env,
napi_handle_scope* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: `napi_value` representing the new scope.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: `napi_value` representing the new scope.
Returns `napi_ok` if the API succeeded.
@@ -1158,8 +1158,8 @@ NAPI_EXTERN napi_status napi_close_handle_scope(napi_env env,
napi_handle_scope scope);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] scope`: `napi_value` representing the scope to be closed.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] scope`: `napi_value` representing the scope to be closed.
Returns `napi_ok` if the API succeeded.
@@ -1180,8 +1180,8 @@ NAPI_EXTERN napi_status
napi_handle_scope* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: `napi_value` representing the new scope.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: `napi_value` representing the new scope.
Returns `napi_ok` if the API succeeded.
@@ -1200,8 +1200,8 @@ NAPI_EXTERN napi_status
napi_handle_scope scope);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] scope`: `napi_value` representing the scope to be closed.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] scope`: `napi_value` representing the scope to be closed.
Returns `napi_ok` if the API succeeded.
@@ -1223,11 +1223,11 @@ napi_status napi_escape_handle(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] scope`: `napi_value` representing the current scope.
-- `[in] escapee`: `napi_value` representing the JavaScript `Object` to be
+* `[in] env`: The environment that the API is invoked under.
+* `[in] scope`: `napi_value` representing the current scope.
+* `[in] escapee`: `napi_value` representing the JavaScript `Object` to be
escaped.
-- `[out] result`: `napi_value` representing the handle to the escaped
+* `[out] result`: `napi_value` representing the handle to the escaped
`Object` in the outer scope.
Returns `napi_ok` if the API succeeded.
@@ -1290,11 +1290,11 @@ NAPI_EXTERN napi_status napi_create_reference(napi_env env,
napi_ref* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing the `Object` to which we want
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing the `Object` to which we want
a reference.
-- `[in] initial_refcount`: Initial reference count for the new reference.
-- `[out] result`: `napi_ref` pointing to the new reference.
+* `[in] initial_refcount`: Initial reference count for the new reference.
+* `[out] result`: `napi_ref` pointing to the new reference.
Returns `napi_ok` if the API succeeded.
@@ -1311,8 +1311,8 @@ napiVersion: 1
NAPI_EXTERN napi_status napi_delete_reference(napi_env env, napi_ref ref);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] ref`: `napi_ref` to be deleted.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] ref`: `napi_ref` to be deleted.
Returns `napi_ok` if the API succeeded.
@@ -1332,9 +1332,9 @@ NAPI_EXTERN napi_status napi_reference_ref(napi_env env,
int* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] ref`: `napi_ref` for which the reference count will be incremented.
-- `[out] result`: The new reference count.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] ref`: `napi_ref` for which the reference count will be incremented.
+* `[out] result`: The new reference count.
Returns `napi_ok` if the API succeeded.
@@ -1353,9 +1353,9 @@ NAPI_EXTERN napi_status napi_reference_unref(napi_env env,
int* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] ref`: `napi_ref` for which the reference count will be decremented.
-- `[out] result`: The new reference count.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] ref`: `napi_ref` for which the reference count will be decremented.
+* `[out] result`: The new reference count.
Returns `napi_ok` if the API succeeded.
@@ -1377,9 +1377,9 @@ NAPI_EXTERN napi_status napi_get_reference_value(napi_env env,
the `napi_value passed` in or out of these methods is a handle to the
object to which the reference is related.
-- `[in] env`: The environment that the API is invoked under.
-- `[in] ref`: `napi_ref` for which we requesting the corresponding `Object`.
-- `[out] result`: The `napi_value` for the `Object` referenced by the
+* `[in] env`: The environment that the API is invoked under.
+* `[in] ref`: `napi_ref` for which we requesting the corresponding `Object`.
+* `[out] result`: The `napi_value` for the `Object` referenced by the
`napi_ref`.
Returns `napi_ok` if the API succeeded.
@@ -1636,8 +1636,8 @@ napiVersion: 1
napi_status napi_create_array(napi_env env, napi_value* result)
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[out] result`: A `napi_value` representing a JavaScript `Array`.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[out] result`: A `napi_value` representing a JavaScript `Array`.
Returns `napi_ok` if the API succeeded.
@@ -1657,9 +1657,9 @@ napi_status napi_create_array_with_length(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] length`: The initial length of the `Array`.
-- `[out] result`: A `napi_value` representing a JavaScript `Array`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] length`: The initial length of the `Array`.
+* `[out] result`: A `napi_value` representing a JavaScript `Array`.
Returns `napi_ok` if the API succeeded.
@@ -1688,10 +1688,10 @@ napi_status napi_create_arraybuffer(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] length`: The length in bytes of the array buffer to create.
-- `[out] data`: Pointer to the underlying byte buffer of the `ArrayBuffer`.
-- `[out] result`: A `napi_value` representing a JavaScript `ArrayBuffer`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] length`: The length in bytes of the array buffer to create.
+* `[out] data`: Pointer to the underlying byte buffer of the `ArrayBuffer`.
+* `[out] result`: A `napi_value` representing a JavaScript `ArrayBuffer`.
Returns `napi_ok` if the API succeeded.
@@ -1721,10 +1721,10 @@ napi_status napi_create_buffer(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] size`: Size in bytes of the underlying buffer.
-- `[out] data`: Raw pointer to the underlying buffer.
-- `[out] result`: A `napi_value` representing a `node::Buffer`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] size`: Size in bytes of the underlying buffer.
+* `[out] data`: Raw pointer to the underlying buffer.
+* `[out] result`: A `napi_value` representing a `node::Buffer`.
Returns `napi_ok` if the API succeeded.
@@ -1745,12 +1745,12 @@ napi_status napi_create_buffer_copy(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] size`: Size in bytes of the input buffer (should be the same as the
+* `[in] env`: The environment that the API is invoked under.
+* `[in] size`: Size in bytes of the input buffer (should be the same as the
size of the new buffer).
-- `[in] data`: Raw pointer to the underlying buffer to copy from.
-- `[out] result_data`: Pointer to the new `Buffer`'s underlying data buffer.
-- `[out] result`: A `napi_value` representing a `node::Buffer`.
+* `[in] data`: Raw pointer to the underlying buffer to copy from.
+* `[out] result_data`: Pointer to the new `Buffer`'s underlying data buffer.
+* `[out] result`: A `napi_value` representing a `node::Buffer`.
Returns `napi_ok` if the API succeeded.
@@ -1769,9 +1769,9 @@ napi_status napi_create_date(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] time`: ECMAScript time value in milliseconds since 01 January, 1970 UTC.
-- `[out] result`: A `napi_value` representing a JavaScript `Date`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] time`: ECMAScript time value in milliseconds since 01 January, 1970 UTC.
+* `[out] result`: A `napi_value` representing a JavaScript `Date`.
Returns `napi_ok` if the API succeeded.
@@ -1794,13 +1794,13 @@ napi_status napi_create_external(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] data`: Raw pointer to the external data.
-- `[in] finalize_cb`: Optional callback to call when the external value
+* `[in] env`: The environment that the API is invoked under.
+* `[in] data`: Raw pointer to the external data.
+* `[in] finalize_cb`: Optional callback to call when the external value
is being collected.
-- `[in] finalize_hint`: Optional hint to pass to the finalize callback
+* `[in] finalize_hint`: Optional hint to pass to the finalize callback
during collection.
-- `[out] result`: A `napi_value` representing an external value.
+* `[out] result`: A `napi_value` representing an external value.
Returns `napi_ok` if the API succeeded.
@@ -1830,15 +1830,15 @@ napi_create_external_arraybuffer(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] external_data`: Pointer to the underlying byte buffer of the
+* `[in] env`: The environment that the API is invoked under.
+* `[in] external_data`: Pointer to the underlying byte buffer of the
`ArrayBuffer`.
-- `[in] byte_length`: The length in bytes of the underlying buffer.
-- `[in] finalize_cb`: Optional callback to call when the `ArrayBuffer` is
+* `[in] byte_length`: The length in bytes of the underlying buffer.
+* `[in] finalize_cb`: Optional callback to call when the `ArrayBuffer` is
being collected.
-- `[in] finalize_hint`: Optional hint to pass to the finalize callback
+* `[in] finalize_hint`: Optional hint to pass to the finalize callback
during collection.
-- `[out] result`: A `napi_value` representing a JavaScript `ArrayBuffer`.
+* `[out] result`: A `napi_value` representing a JavaScript `ArrayBuffer`.
Returns `napi_ok` if the API succeeded.
@@ -1865,15 +1865,15 @@ napi_status napi_create_external_buffer(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] length`: Size in bytes of the input buffer (should be the same as
+* `[in] env`: The environment that the API is invoked under.
+* `[in] length`: Size in bytes of the input buffer (should be the same as
the size of the new buffer).
-- `[in] data`: Raw pointer to the underlying buffer to copy from.
-- `[in] finalize_cb`: Optional callback to call when the `ArrayBuffer` is
+* `[in] data`: Raw pointer to the underlying buffer to copy from.
+* `[in] finalize_cb`: Optional callback to call when the `ArrayBuffer` is
being collected.
-- `[in] finalize_hint`: Optional hint to pass to the finalize callback
+* `[in] finalize_hint`: Optional hint to pass to the finalize callback
during collection.
-- `[out] result`: A `napi_value` representing a `node::Buffer`.
+* `[out] result`: A `napi_value` representing a `node::Buffer`.
Returns `napi_ok` if the API succeeded.
@@ -1893,8 +1893,8 @@ napiVersion: 1
napi_status napi_create_object(napi_env env, napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: A `napi_value` representing a JavaScript `Object`.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: A `napi_value` representing a JavaScript `Object`.
Returns `napi_ok` if the API succeeded.
@@ -1917,10 +1917,10 @@ napi_status napi_create_symbol(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] description`: Optional `napi_value` which refers to a JavaScript
+* `[in] env`: The environment that the API is invoked under.
+* `[in] description`: Optional `napi_value` which refers to a JavaScript
`String` to be set as the description for the symbol.
-- `[out] result`: A `napi_value` representing a JavaScript `Symbol`.
+* `[out] result`: A `napi_value` representing a JavaScript `Symbol`.
Returns `napi_ok` if the API succeeded.
@@ -1945,13 +1945,13 @@ napi_status napi_create_typedarray(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] type`: Scalar datatype of the elements within the `TypedArray`.
-- `[in] length`: Number of elements in the `TypedArray`.
-- `[in] arraybuffer`: `ArrayBuffer` underlying the typed array.
-- `[in] byte_offset`: The byte offset within the `ArrayBuffer` from which to
+* `[in] env`: The environment that the API is invoked under.
+* `[in] type`: Scalar datatype of the elements within the `TypedArray`.
+* `[in] length`: Number of elements in the `TypedArray`.
+* `[in] arraybuffer`: `ArrayBuffer` underlying the typed array.
+* `[in] byte_offset`: The byte offset within the `ArrayBuffer` from which to
start projecting the `TypedArray`.
-- `[out] result`: A `napi_value` representing a JavaScript `TypedArray`.
+* `[out] result`: A `napi_value` representing a JavaScript `TypedArray`.
Returns `napi_ok` if the API succeeded.
@@ -1981,12 +1981,12 @@ napi_status napi_create_dataview(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] length`: Number of elements in the `DataView`.
-- `[in] arraybuffer`: `ArrayBuffer` underlying the `DataView`.
-- `[in] byte_offset`: The byte offset within the `ArrayBuffer` from which to
+* `[in] env`: The environment that the API is invoked under.
+* `[in] length`: Number of elements in the `DataView`.
+* `[in] arraybuffer`: `ArrayBuffer` underlying the `DataView`.
+* `[in] byte_offset`: The byte offset within the `ArrayBuffer` from which to
start projecting the `DataView`.
-- `[out] result`: A `napi_value` representing a JavaScript `DataView`.
+* `[out] result`: A `napi_value` representing a JavaScript `DataView`.
Returns `napi_ok` if the API succeeded.
@@ -2012,9 +2012,9 @@ napiVersion: 1
napi_status napi_create_int32(napi_env env, int32_t value, napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: Integer value to be represented in JavaScript.
-- `[out] result`: A `napi_value` representing a JavaScript `Number`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: Integer value to be represented in JavaScript.
+* `[out] result`: A `napi_value` representing a JavaScript `Number`.
Returns `napi_ok` if the API succeeded.
@@ -2034,9 +2034,9 @@ napiVersion: 1
napi_status napi_create_uint32(napi_env env, uint32_t value, napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: Unsigned integer value to be represented in JavaScript.
-- `[out] result`: A `napi_value` representing a JavaScript `Number`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: Unsigned integer value to be represented in JavaScript.
+* `[out] result`: A `napi_value` representing a JavaScript `Number`.
Returns `napi_ok` if the API succeeded.
@@ -2056,9 +2056,9 @@ napiVersion: 1
napi_status napi_create_int64(napi_env env, int64_t value, napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: Integer value to be represented in JavaScript.
-- `[out] result`: A `napi_value` representing a JavaScript `Number`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: Integer value to be represented in JavaScript.
+* `[out] result`: A `napi_value` representing a JavaScript `Number`.
Returns `napi_ok` if the API succeeded.
@@ -2084,9 +2084,9 @@ napiVersion: 1
napi_status napi_create_double(napi_env env, double value, napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: Double-precision value to be represented in JavaScript.
-- `[out] result`: A `napi_value` representing a JavaScript `Number`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: Double-precision value to be represented in JavaScript.
+* `[out] result`: A `napi_value` representing a JavaScript `Number`.
Returns `napi_ok` if the API succeeded.
@@ -2109,9 +2109,9 @@ napi_status napi_create_bigint_int64(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: Integer value to be represented in JavaScript.
-- `[out] result`: A `napi_value` representing a JavaScript `BigInt`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: Integer value to be represented in JavaScript.
+* `[out] result`: A `napi_value` representing a JavaScript `BigInt`.
Returns `napi_ok` if the API succeeded.
@@ -2130,9 +2130,9 @@ napi_status napi_create_bigint_uint64(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: Unsigned integer value to be represented in JavaScript.
-- `[out] result`: A `napi_value` representing a JavaScript `BigInt`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: Unsigned integer value to be represented in JavaScript.
+* `[out] result`: A `napi_value` representing a JavaScript `BigInt`.
Returns `napi_ok` if the API succeeded.
@@ -2153,12 +2153,12 @@ napi_status napi_create_bigint_words(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] sign_bit`: Determines if the resulting `BigInt` will be positive or
+* `[in] env`: The environment that the API is invoked under.
+* `[in] sign_bit`: Determines if the resulting `BigInt` will be positive or
negative.
-- `[in] word_count`: The length of the `words` array.
-- `[in] words`: An array of `uint64_t` little-endian 64-bit words.
-- `[out] result`: A `napi_value` representing a JavaScript `BigInt`.
+* `[in] word_count`: The length of the `words` array.
+* `[in] words`: An array of `uint64_t` little-endian 64-bit words.
+* `[out] result`: A `napi_value` representing a JavaScript `BigInt`.
Returns `napi_ok` if the API succeeded.
@@ -2181,11 +2181,11 @@ napi_status napi_create_string_latin1(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] str`: Character buffer representing an ISO-8859-1-encoded string.
-- `[in] length`: The length of the string in bytes, or
+* `[in] env`: The environment that the API is invoked under.
+* `[in] str`: Character buffer representing an ISO-8859-1-encoded string.
+* `[in] length`: The length of the string in bytes, or
`NAPI_AUTO_LENGTH` if it is null-terminated.
-- `[out] result`: A `napi_value` representing a JavaScript `String`.
+* `[out] result`: A `napi_value` representing a JavaScript `String`.
Returns `napi_ok` if the API succeeded.
@@ -2208,11 +2208,11 @@ napi_status napi_create_string_utf16(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] str`: Character buffer representing a UTF16-LE-encoded string.
-- `[in] length`: The length of the string in two-byte code units, or
+* `[in] env`: The environment that the API is invoked under.
+* `[in] str`: Character buffer representing a UTF16-LE-encoded string.
+* `[in] length`: The length of the string in two-byte code units, or
`NAPI_AUTO_LENGTH` if it is null-terminated.
-- `[out] result`: A `napi_value` representing a JavaScript `String`.
+* `[out] result`: A `napi_value` representing a JavaScript `String`.
Returns `napi_ok` if the API succeeded.
@@ -2235,11 +2235,11 @@ napi_status napi_create_string_utf8(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] str`: Character buffer representing a UTF8-encoded string.
-- `[in] length`: The length of the string in bytes, or `NAPI_AUTO_LENGTH`
+* `[in] env`: The environment that the API is invoked under.
+* `[in] str`: Character buffer representing a UTF8-encoded string.
+* `[in] length`: The length of the string in bytes, or `NAPI_AUTO_LENGTH`
if it is null-terminated.
-- `[out] result`: A `napi_value` representing a JavaScript `String`.
+* `[out] result`: A `napi_value` representing a JavaScript `String`.
Returns `napi_ok` if the API succeeded.
@@ -2262,10 +2262,10 @@ napi_status napi_get_array_length(napi_env env,
uint32_t* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing the JavaScript `Array` whose length is
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing the JavaScript `Array` whose length is
being queried.
-- `[out] result`: `uint32` representing length of the array.
+* `[out] result`: `uint32` representing length of the array.
Returns `napi_ok` if the API succeeded.
@@ -2288,10 +2288,10 @@ napi_status napi_get_arraybuffer_info(napi_env env,
size_t* byte_length)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] arraybuffer`: `napi_value` representing the `ArrayBuffer` being queried.
-- `[out] data`: The underlying data buffer of the `ArrayBuffer`.
-- `[out] byte_length`: Length in bytes of the underlying data buffer.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] arraybuffer`: `napi_value` representing the `ArrayBuffer` being queried.
+* `[out] data`: The underlying data buffer of the `ArrayBuffer`.
+* `[out] byte_length`: Length in bytes of the underlying data buffer.
Returns `napi_ok` if the API succeeded.
@@ -2319,10 +2319,10 @@ napi_status napi_get_buffer_info(napi_env env,
size_t* length)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing the `node::Buffer` being queried.
-- `[out] data`: The underlying data buffer of the `node::Buffer`.
-- `[out] length`: Length in bytes of the underlying data buffer.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing the `node::Buffer` being queried.
+* `[out] data`: The underlying data buffer of the `node::Buffer`.
+* `[out] length`: Length in bytes of the underlying data buffer.
Returns `napi_ok` if the API succeeded.
@@ -2344,11 +2344,11 @@ napi_status napi_get_prototype(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] object`: `napi_value` representing JavaScript `Object` whose prototype
+* `[in] env`: The environment that the API is invoked under.
+* `[in] object`: `napi_value` representing JavaScript `Object` whose prototype
to return. This returns the equivalent of `Object.getPrototypeOf` (which is
not the same as the function's `prototype` property).
-- `[out] result`: `napi_value` representing prototype of the given object.
+* `[out] result`: `napi_value` representing prototype of the given object.
Returns `napi_ok` if the API succeeded.
@@ -2368,16 +2368,16 @@ napi_status napi_get_typedarray_info(napi_env env,
size_t* byte_offset)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] typedarray`: `napi_value` representing the `TypedArray` whose
+* `[in] env`: The environment that the API is invoked under.
+* `[in] typedarray`: `napi_value` representing the `TypedArray` whose
properties to query.
-- `[out] type`: Scalar datatype of the elements within the `TypedArray`.
-- `[out] length`: The number of elements in the `TypedArray`.
-- `[out] data`: The data buffer underlying the `TypedArray` adjusted by
+* `[out] type`: Scalar datatype of the elements within the `TypedArray`.
+* `[out] length`: The number of elements in the `TypedArray`.
+* `[out] data`: The data buffer underlying the `TypedArray` adjusted by
the `byte_offset` value so that it points to the first element in the
`TypedArray`.
-- `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`.
-- `[out] byte_offset`: The byte offset within the underlying native array
+* `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`.
+* `[out] byte_offset`: The byte offset within the underlying native array
at which the first element of the arrays is located. The value for the data
parameter has already been adjusted so that data points to the first element
in the array. Therefore, the first byte of the native array would be at
@@ -2405,13 +2405,13 @@ napi_status napi_get_dataview_info(napi_env env,
size_t* byte_offset)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] dataview`: `napi_value` representing the `DataView` whose
+* `[in] env`: The environment that the API is invoked under.
+* `[in] dataview`: `napi_value` representing the `DataView` whose
properties to query.
-- `[out] byte_length`: `Number` of bytes in the `DataView`.
-- `[out] data`: The data buffer underlying the `DataView`.
-- `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`.
-- `[out] byte_offset`: The byte offset within the data buffer from which
+* `[out] byte_length`: `Number` of bytes in the `DataView`.
+* `[out] data`: The data buffer underlying the `DataView`.
+* `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`.
+* `[out] byte_offset`: The byte offset within the data buffer from which
to start projecting the `DataView`.
Returns `napi_ok` if the API succeeded.
@@ -2429,9 +2429,9 @@ napi_status napi_get_date_value(napi_env env,
double* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing a JavaScript `Date`.
-- `[out] result`: Time value as a `double` represented as milliseconds
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing a JavaScript `Date`.
+* `[out] result`: Time value as a `double` represented as milliseconds
since midnight at the beginning of 01 January, 1970 UTC.
Returns `napi_ok` if the API succeeded. If a non-date `napi_value` is passed
@@ -2450,9 +2450,9 @@ napiVersion: 1
napi_status napi_get_value_bool(napi_env env, napi_value value, bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript `Boolean`.
-- `[out] result`: C boolean primitive equivalent of the given JavaScript
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript `Boolean`.
+* `[out] result`: C boolean primitive equivalent of the given JavaScript
`Boolean`.
Returns `napi_ok` if the API succeeded. If a non-boolean `napi_value` is
@@ -2473,9 +2473,9 @@ napi_status napi_get_value_double(napi_env env,
double* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript `Number`.
-- `[out] result`: C double primitive equivalent of the given JavaScript
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript `Number`.
+* `[out] result`: C double primitive equivalent of the given JavaScript
`Number`.
Returns `napi_ok` if the API succeeded. If a non-number `napi_value` is passed
@@ -2498,11 +2498,11 @@ napi_status napi_get_value_bigint_int64(napi_env env,
bool* lossless);
```
-- `[in] env`: The environment that the API is invoked under
-- `[in] value`: `napi_value` representing JavaScript `BigInt`.
-- `[out] result`: C `int64_t` primitive equivalent of the given JavaScript
+* `[in] env`: The environment that the API is invoked under
+* `[in] value`: `napi_value` representing JavaScript `BigInt`.
+* `[out] result`: C `int64_t` primitive equivalent of the given JavaScript
`BigInt`.
-- `[out] lossless`: Indicates whether the `BigInt` value was converted
+* `[out] lossless`: Indicates whether the `BigInt` value was converted
losslessly.
Returns `napi_ok` if the API succeeded. If a non-`BigInt` is passed in it
@@ -2525,11 +2525,11 @@ napi_status napi_get_value_bigint_uint64(napi_env env,
bool* lossless);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript `BigInt`.
-- `[out] result`: C `uint64_t` primitive equivalent of the given JavaScript
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript `BigInt`.
+* `[out] result`: C `uint64_t` primitive equivalent of the given JavaScript
`BigInt`.
-- `[out] lossless`: Indicates whether the `BigInt` value was converted
+* `[out] lossless`: Indicates whether the `BigInt` value was converted
losslessly.
Returns `napi_ok` if the API succeeded. If a non-`BigInt` is passed in it
@@ -2553,14 +2553,14 @@ napi_status napi_get_value_bigint_words(napi_env env,
uint64_t* words);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript `BigInt`.
-- `[out] sign_bit`: Integer representing if the JavaScript `BigInt` is positive
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript `BigInt`.
+* `[out] sign_bit`: Integer representing if the JavaScript `BigInt` is positive
or negative.
-- `[in/out] word_count`: Must be initialized to the length of the `words`
+* `[in/out] word_count`: Must be initialized to the length of the `words`
array. Upon return, it will be set to the actual number of words that
would be needed to store this `BigInt`.
-- `[out] words`: Pointer to a pre-allocated 64-bit word array.
+* `[out] words`: Pointer to a pre-allocated 64-bit word array.
Returns `napi_ok` if the API succeeded.
@@ -2580,9 +2580,9 @@ napi_status napi_get_value_external(napi_env env,
void** result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript external value.
-- `[out] result`: Pointer to the data wrapped by the JavaScript external value.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript external value.
+* `[out] result`: Pointer to the data wrapped by the JavaScript external value.
Returns `napi_ok` if the API succeeded. If a non-external `napi_value` is
passed in it returns `napi_invalid_arg`.
@@ -2602,9 +2602,9 @@ napi_status napi_get_value_int32(napi_env env,
int32_t* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript `Number`.
-- `[out] result`: C `int32` primitive equivalent of the given JavaScript
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript `Number`.
+* `[out] result`: C `int32` primitive equivalent of the given JavaScript
`Number`.
Returns `napi_ok` if the API succeeded. If a non-number `napi_value`
@@ -2632,9 +2632,9 @@ napi_status napi_get_value_int64(napi_env env,
int64_t* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript `Number`.
-- `[out] result`: C `int64` primitive equivalent of the given JavaScript
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript `Number`.
+* `[out] result`: C `int64` primitive equivalent of the given JavaScript
`Number`.
Returns `napi_ok` if the API succeeded. If a non-number `napi_value`
@@ -2666,13 +2666,13 @@ napi_status napi_get_value_string_latin1(napi_env env,
size_t* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript string.
-- `[in] buf`: Buffer to write the ISO-8859-1-encoded string into. If NULL is
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript string.
+* `[in] buf`: Buffer to write the ISO-8859-1-encoded string into. If NULL is
passed in, the length of the string (in bytes) is returned.
-- `[in] bufsize`: Size of the destination buffer. When this value is
+* `[in] bufsize`: Size of the destination buffer. When this value is
insufficient, the returned string will be truncated.
-- `[out] result`: Number of bytes copied into the buffer, excluding the null
+* `[out] result`: Number of bytes copied into the buffer, excluding the null
terminator.
Returns `napi_ok` if the API succeeded. If a non-`String` `napi_value`
@@ -2695,13 +2695,13 @@ napi_status napi_get_value_string_utf8(napi_env env,
size_t* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript string.
-- `[in] buf`: Buffer to write the UTF8-encoded string into. If NULL is passed
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript string.
+* `[in] buf`: Buffer to write the UTF8-encoded string into. If NULL is passed
in, the length of the string (in bytes) is returned.
-- `[in] bufsize`: Size of the destination buffer. When this value is
+* `[in] bufsize`: Size of the destination buffer. When this value is
insufficient, the returned string will be truncated.
-- `[out] result`: Number of bytes copied into the buffer, excluding the null
+* `[out] result`: Number of bytes copied into the buffer, excluding the null
terminator.
Returns `napi_ok` if the API succeeded. If a non-`String` `napi_value`
@@ -2723,13 +2723,13 @@ napi_status napi_get_value_string_utf16(napi_env env,
size_t* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript string.
-- `[in] buf`: Buffer to write the UTF16-LE-encoded string into. If NULL is
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript string.
+* `[in] buf`: Buffer to write the UTF16-LE-encoded string into. If NULL is
passed in, the length of the string (in 2-byte code units) is returned.
-- `[in] bufsize`: Size of the destination buffer. When this value is
+* `[in] bufsize`: Size of the destination buffer. When this value is
insufficient, the returned string will be truncated.
-- `[out] result`: Number of 2-byte code units copied into the buffer, excluding
+* `[out] result`: Number of 2-byte code units copied into the buffer, excluding
the null terminator.
Returns `napi_ok` if the API succeeded. If a non-`String` `napi_value`
@@ -2749,9 +2749,9 @@ napi_status napi_get_value_uint32(napi_env env,
uint32_t* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: `napi_value` representing JavaScript `Number`.
-- `[out] result`: C primitive equivalent of the given `napi_value` as a
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: `napi_value` representing JavaScript `Number`.
+* `[out] result`: C primitive equivalent of the given `napi_value` as a
`uint32_t`.
Returns `napi_ok` if the API succeeded. If a non-number `napi_value`
@@ -2771,9 +2771,9 @@ napiVersion: 1
napi_status napi_get_boolean(napi_env env, bool value, napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The value of the boolean to retrieve.
-- `[out] result`: `napi_value` representing JavaScript `Boolean` singleton to
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The value of the boolean to retrieve.
+* `[out] result`: `napi_value` representing JavaScript `Boolean` singleton to
retrieve.
Returns `napi_ok` if the API succeeded.
@@ -2791,8 +2791,8 @@ napiVersion: 1
napi_status napi_get_global(napi_env env, napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: `napi_value` representing JavaScript `global` object.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: `napi_value` representing JavaScript `global` object.
Returns `napi_ok` if the API succeeded.
@@ -2808,8 +2808,8 @@ napiVersion: 1
napi_status napi_get_null(napi_env env, napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: `napi_value` representing JavaScript `null` object.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: `napi_value` representing JavaScript `null` object.
Returns `napi_ok` if the API succeeded.
@@ -2825,8 +2825,8 @@ napiVersion: 1
napi_status napi_get_undefined(napi_env env, napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: `napi_value` representing JavaScript Undefined value.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: `napi_value` representing JavaScript Undefined value.
Returns `napi_ok` if the API succeeded.
@@ -2858,9 +2858,9 @@ napi_status napi_coerce_to_bool(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to coerce.
-- `[out] result`: `napi_value` representing the coerced JavaScript `Boolean`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to coerce.
+* `[out] result`: `napi_value` representing the coerced JavaScript `Boolean`.
Returns `napi_ok` if the API succeeded.
@@ -2881,9 +2881,9 @@ napi_status napi_coerce_to_number(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to coerce.
-- `[out] result`: `napi_value` representing the coerced JavaScript `Number`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to coerce.
+* `[out] result`: `napi_value` representing the coerced JavaScript `Number`.
Returns `napi_ok` if the API succeeded.
@@ -2904,9 +2904,9 @@ napi_status napi_coerce_to_object(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to coerce.
-- `[out] result`: `napi_value` representing the coerced JavaScript `Object`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to coerce.
+* `[out] result`: `napi_value` representing the coerced JavaScript `Object`.
Returns `napi_ok` if the API succeeded.
@@ -2927,9 +2927,9 @@ napi_status napi_coerce_to_string(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to coerce.
-- `[out] result`: `napi_value` representing the coerced JavaScript `String`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to coerce.
+* `[out] result`: `napi_value` representing the coerced JavaScript `String`.
Returns `napi_ok` if the API succeeded.
@@ -2948,13 +2948,13 @@ napiVersion: 1
napi_status napi_typeof(napi_env env, napi_value value, napi_valuetype* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value whose type to query.
-- `[out] result`: The type of the JavaScript value.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value whose type to query.
+* `[out] result`: The type of the JavaScript value.
Returns `napi_ok` if the API succeeded.
-- `napi_invalid_arg` if the type of `value` is not a known ECMAScript type and
+* `napi_invalid_arg` if the type of `value` is not a known ECMAScript type and
`value` is not an External value.
This API represents behavior similar to invoking the `typeof` Operator on
@@ -2975,11 +2975,11 @@ napi_status napi_instanceof(napi_env env,
bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] object`: The JavaScript value to check.
-- `[in] constructor`: The JavaScript function object of the constructor
+* `[in] env`: The environment that the API is invoked under.
+* `[in] object`: The JavaScript value to check.
+* `[in] constructor`: The JavaScript function object of the constructor
function to check against.
-- `[out] result`: Boolean that is set to true if `object instanceof constructor`
+* `[out] result`: Boolean that is set to true if `object instanceof constructor`
is true.
Returns `napi_ok` if the API succeeded.
@@ -2999,9 +2999,9 @@ napiVersion: 1
napi_status napi_is_array(napi_env env, napi_value value, bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to check.
-- `[out] result`: Whether the given object is an array.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to check.
+* `[out] result`: Whether the given object is an array.
Returns `napi_ok` if the API succeeded.
@@ -3019,9 +3019,9 @@ napiVersion: 1
napi_status napi_is_arraybuffer(napi_env env, napi_value value, bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to check.
-- `[out] result`: Whether the given object is an `ArrayBuffer`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to check.
+* `[out] result`: Whether the given object is an `ArrayBuffer`.
Returns `napi_ok` if the API succeeded.
@@ -3037,9 +3037,9 @@ napiVersion: 1
napi_status napi_is_buffer(napi_env env, napi_value value, bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to check.
-- `[out] result`: Whether the given `napi_value` represents a `node::Buffer`
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to check.
+* `[out] result`: Whether the given `napi_value` represents a `node::Buffer`
object.
Returns `napi_ok` if the API succeeded.
@@ -3055,9 +3055,9 @@ added: v11.11.0
napi_status napi_is_date(napi_env env, napi_value value, bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to check.
-- `[out] result`: Whether the given `napi_value` represents a JavaScript `Date`
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to check.
+* `[out] result`: Whether the given `napi_value` represents a JavaScript `Date`
object.
Returns `napi_ok` if the API succeeded.
@@ -3074,9 +3074,9 @@ napiVersion: 1
napi_status napi_is_error(napi_env env, napi_value value, bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to check.
-- `[out] result`: Whether the given `napi_value` represents an `Error` object.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to check.
+* `[out] result`: Whether the given `napi_value` represents an `Error` object.
Returns `napi_ok` if the API succeeded.
@@ -3092,9 +3092,9 @@ napiVersion: 1
napi_status napi_is_typedarray(napi_env env, napi_value value, bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to check.
-- `[out] result`: Whether the given `napi_value` represents a `TypedArray`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to check.
+* `[out] result`: Whether the given `napi_value` represents a `TypedArray`.
Returns `napi_ok` if the API succeeded.
@@ -3110,9 +3110,9 @@ napiVersion: 1
napi_status napi_is_dataview(napi_env env, napi_value value, bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] value`: The JavaScript value to check.
-- `[out] result`: Whether the given `napi_value` represents a `DataView`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] value`: The JavaScript value to check.
+* `[out] result`: Whether the given `napi_value` represents a `DataView`.
Returns `napi_ok` if the API succeeded.
@@ -3131,10 +3131,10 @@ napi_status napi_strict_equals(napi_env env,
bool* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] lhs`: The JavaScript value to check.
-- `[in] rhs`: The JavaScript value to check against.
-- `[out] result`: Whether the two `napi_value` objects are equal.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] lhs`: The JavaScript value to check.
+* `[in] rhs`: The JavaScript value to check against.
+* `[out] result`: Whether the two `napi_value` objects are equal.
Returns `napi_ok` if the API succeeded.
@@ -3154,9 +3154,9 @@ Properties in JavaScript are represented as a tuple of a key and a value.
Fundamentally, all property keys in N-API can be represented in one of the
following forms:
-- Named: a simple UTF8-encoded string
-- Integer-Indexed: an index value represented by `uint32_t`
-- JavaScript value: these are represented in N-API by `napi_value`. This can
+* Named: a simple UTF8-encoded string
+* Integer-Indexed: an index value represented by `uint32_t`
+* JavaScript value: these are represented in N-API by `napi_value`. This can
be a `napi_value` representing a `String`, `Number`, or `Symbol`.
N-API values are represented by the type `napi_value`.
@@ -3306,14 +3306,14 @@ attributes listed in [Section 6.1.7.1][]
of the [ECMAScript Language Specification][].
They can be one or more of the following bitflags:
-- `napi_default` - Used to indicate that no explicit attributes are set on the
+* `napi_default` - Used to indicate that no explicit attributes are set on the
given property. By default, a property is read only, not enumerable and not
configurable.
-- `napi_writable` - Used to indicate that a given property is writable.
-- `napi_enumerable` - Used to indicate that a given property is enumerable.
-- `napi_configurable` - Used to indicate that a given property is configurable,
+* `napi_writable` - Used to indicate that a given property is writable.
+* `napi_enumerable` - Used to indicate that a given property is enumerable.
+* `napi_configurable` - Used to indicate that a given property is configurable,
as defined in [Section 6.1.7.1][] of the [ECMAScript Language Specification][].
-- `napi_static` - Used to indicate that the property will be defined as
+* `napi_static` - Used to indicate that the property will be defined as
a static property on a class as opposed to an instance property, which is the
default. This is used only by [`napi_define_class`][]. It is ignored by
`napi_define_properties`.
@@ -3336,32 +3336,32 @@ typedef struct {
} napi_property_descriptor;
```
-- `utf8name`: Optional `String` describing the key for the property,
+* `utf8name`: Optional `String` describing the key for the property,
encoded as UTF8. One of `utf8name` or `name` must be provided for the
property.
-- `name`: Optional `napi_value` that points to a JavaScript string or symbol
+* `name`: Optional `napi_value` that points to a JavaScript string or symbol
to be used as the key for the property. One of `utf8name` or `name` must
be provided for the property.
-- `value`: The value that's retrieved by a get access of the property if the
+* `value`: The value that's retrieved by a get access of the property if the
property is a data property. If this is passed in, set `getter`, `setter`,
`method` and `data` to `NULL` (since these members won't be used).
-- `getter`: A function to call when a get access of the property is performed.
+* `getter`: A function to call when a get access of the property is performed.
If this is passed in, set `value` and `method` to `NULL` (since these members
won't be used). The given function is called implicitly by the runtime when the
property is accessed from JavaScript code (or if a get on the property is
performed using a N-API call).
-- `setter`: A function to call when a set access of the property is performed.
+* `setter`: A function to call when a set access of the property is performed.
If this is passed in, set `value` and `method` to `NULL` (since these members
won't be used). The given function is called implicitly by the runtime when the
property is set from JavaScript code (or if a set on the property is
performed using a N-API call).
-- `method`: Set this to make the property descriptor object's `value`
+* `method`: Set this to make the property descriptor object's `value`
property to be a JavaScript function represented by `method`. If this is
passed in, set `value`, `getter` and `setter` to `NULL` (since these members
won't be used).
-- `attributes`: The attributes associated with the particular property.
+* `attributes`: The attributes associated with the particular property.
See [`napi_property_attributes`](#n_api_napi_property_attributes).
-- `data`: The callback data passed into `method`, `getter` and `setter` if
+* `data`: The callback data passed into `method`, `getter` and `setter` if
this function is invoked.
### Functions
@@ -3377,9 +3377,9 @@ napi_status napi_get_property_names(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object from which to retrieve the properties.
-- `[out] result`: A `napi_value` representing an array of JavaScript values
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object from which to retrieve the properties.
+* `[out] result`: A `napi_value` representing an array of JavaScript values
that represent the property names of the object. The API can be used to
iterate over `result` using [`napi_get_array_length`][]
and [`napi_get_element`][].
@@ -3403,10 +3403,10 @@ napi_status napi_set_property(napi_env env,
napi_value value);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object on which to set the property.
-- `[in] key`: The name of the property to set.
-- `[in] value`: The property value.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object on which to set the property.
+* `[in] key`: The name of the property to set.
+* `[in] value`: The property value.
Returns `napi_ok` if the API succeeded.
@@ -3425,10 +3425,10 @@ napi_status napi_get_property(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object from which to retrieve the property.
-- `[in] key`: The name of the property to retrieve.
-- `[out] result`: The value of the property.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object from which to retrieve the property.
+* `[in] key`: The name of the property to retrieve.
+* `[out] result`: The value of the property.
Returns `napi_ok` if the API succeeded.
@@ -3447,10 +3447,10 @@ napi_status napi_has_property(napi_env env,
bool* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object to query.
-- `[in] key`: The name of the property whose existence to check.
-- `[out] result`: Whether the property exists on the object or not.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object to query.
+* `[in] key`: The name of the property whose existence to check.
+* `[out] result`: Whether the property exists on the object or not.
Returns `napi_ok` if the API succeeded.
@@ -3469,10 +3469,10 @@ napi_status napi_delete_property(napi_env env,
bool* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object to query.
-- `[in] key`: The name of the property to delete.
-- `[out] result`: Whether the property deletion succeeded or not. `result` can
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object to query.
+* `[in] key`: The name of the property to delete.
+* `[out] result`: Whether the property deletion succeeded or not. `result` can
optionally be ignored by passing `NULL`.
Returns `napi_ok` if the API succeeded.
@@ -3492,10 +3492,10 @@ napi_status napi_has_own_property(napi_env env,
bool* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object to query.
-- `[in] key`: The name of the own property whose existence to check.
-- `[out] result`: Whether the own property exists on the object or not.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object to query.
+* `[in] key`: The name of the own property whose existence to check.
+* `[out] result`: Whether the own property exists on the object or not.
Returns `napi_ok` if the API succeeded.
@@ -3516,10 +3516,10 @@ napi_status napi_set_named_property(napi_env env,
napi_value value);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object on which to set the property.
-- `[in] utf8Name`: The name of the property to set.
-- `[in] value`: The property value.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object on which to set the property.
+* `[in] utf8Name`: The name of the property to set.
+* `[in] value`: The property value.
Returns `napi_ok` if the API succeeded.
@@ -3539,10 +3539,10 @@ napi_status napi_get_named_property(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object from which to retrieve the property.
-- `[in] utf8Name`: The name of the property to get.
-- `[out] result`: The value of the property.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object from which to retrieve the property.
+* `[in] utf8Name`: The name of the property to get.
+* `[out] result`: The value of the property.
Returns `napi_ok` if the API succeeded.
@@ -3562,10 +3562,10 @@ napi_status napi_has_named_property(napi_env env,
bool* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object to query.
-- `[in] utf8Name`: The name of the property whose existence to check.
-- `[out] result`: Whether the property exists on the object or not.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object to query.
+* `[in] utf8Name`: The name of the property whose existence to check.
+* `[out] result`: Whether the property exists on the object or not.
Returns `napi_ok` if the API succeeded.
@@ -3585,10 +3585,10 @@ napi_status napi_set_element(napi_env env,
napi_value value);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object from which to set the properties.
-- `[in] index`: The index of the property to set.
-- `[in] value`: The property value.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object from which to set the properties.
+* `[in] index`: The index of the property to set.
+* `[in] value`: The property value.
Returns `napi_ok` if the API succeeded.
@@ -3607,10 +3607,10 @@ napi_status napi_get_element(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object from which to retrieve the property.
-- `[in] index`: The index of the property to get.
-- `[out] result`: The value of the property.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object from which to retrieve the property.
+* `[in] index`: The index of the property to get.
+* `[out] result`: The value of the property.
Returns `napi_ok` if the API succeeded.
@@ -3629,10 +3629,10 @@ napi_status napi_has_element(napi_env env,
bool* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object to query.
-- `[in] index`: The index of the property whose existence to check.
-- `[out] result`: Whether the property exists on the object or not.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object to query.
+* `[in] index`: The index of the property whose existence to check.
+* `[out] result`: Whether the property exists on the object or not.
Returns `napi_ok` if the API succeeded.
@@ -3652,10 +3652,10 @@ napi_status napi_delete_element(napi_env env,
bool* result);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object to query.
-- `[in] index`: The index of the property to delete.
-- `[out] result`: Whether the element deletion succeeded or not. `result` can
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object to query.
+* `[in] index`: The index of the property to delete.
+* `[out] result`: Whether the element deletion succeeded or not. `result` can
optionally be ignored by passing `NULL`.
Returns `napi_ok` if the API succeeded.
@@ -3675,10 +3675,10 @@ napi_status napi_define_properties(napi_env env,
const napi_property_descriptor* properties);
```
-- `[in] env`: The environment that the N-API call is invoked under.
-- `[in] object`: The object from which to retrieve the properties.
-- `[in] property_count`: The number of elements in the `properties` array.
-- `[in] properties`: The array of property descriptors.
+* `[in] env`: The environment that the N-API call is invoked under.
+* `[in] object`: The object from which to retrieve the properties.
+* `[in] property_count`: The number of elements in the `properties` array.
+* `[in] properties`: The array of property descriptors.
Returns `napi_ok` if the API succeeded.
@@ -3699,9 +3699,9 @@ native code, the `napi_callback` function provided is invoked. The APIs
documented in this section allow the callback function to do the
following:
-- Get information about the context in which the callback was invoked.
-- Get the arguments passed into the callback.
-- Return a `napi_value` back from the callback.
+* Get information about the context in which the callback was invoked.
+* Get the arguments passed into the callback.
+* Return a `napi_value` back from the callback.
Additionally, N-API provides a set of functions which allow calling
JavaScript functions from native code. One can either call a function
@@ -3728,14 +3728,14 @@ napi_status napi_call_function(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] recv`: The `this` object passed to the called function.
-- `[in] func`: `napi_value` representing the JavaScript function
+* `[in] env`: The environment that the API is invoked under.
+* `[in] recv`: The `this` object passed to the called function.
+* `[in] func`: `napi_value` representing the JavaScript function
to be invoked.
-- `[in] argc`: The count of elements in the `argv` array.
-- `[in] argv`: Array of `napi_values` representing JavaScript values passed
+* `[in] argc`: The count of elements in the `argv` array.
+* `[in] argv`: Array of `napi_values` representing JavaScript values passed
in as arguments to the function.
-- `[out] result`: `napi_value` representing the JavaScript object returned.
+* `[out] result`: `napi_value` representing the JavaScript object returned.
Returns `napi_ok` if the API succeeded.
@@ -3798,16 +3798,16 @@ napi_status napi_create_function(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] utf8Name`: The name of the function encoded as UTF8. This is visible
+* `[in] env`: The environment that the API is invoked under.
+* `[in] utf8Name`: The name of the function encoded as UTF8. This is visible
within JavaScript as the new function object's `name` property.
-- `[in] length`: The length of the `utf8name` in bytes, or
+* `[in] length`: The length of the `utf8name` in bytes, or
`NAPI_AUTO_LENGTH` if it is null-terminated.
-- `[in] cb`: The native function which should be called when this function
+* `[in] cb`: The native function which should be called when this function
object is invoked.
-- `[in] data`: User-provided data context. This will be passed back into the
+* `[in] data`: User-provided data context. This will be passed back into the
function when invoked later.
-- `[out] result`: `napi_value` representing the JavaScript function object for
+* `[out] result`: `napi_value` representing the JavaScript function object for
the newly created function.
Returns `napi_ok` if the API succeeded.
@@ -3880,17 +3880,17 @@ napi_status napi_get_cb_info(napi_env env,
void** data)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] cbinfo`: The callback info passed into the callback function.
-- `[in-out] argc`: Specifies the size of the provided `argv` array
+* `[in] env`: The environment that the API is invoked under.
+* `[in] cbinfo`: The callback info passed into the callback function.
+* `[in-out] argc`: Specifies the size of the provided `argv` array
and receives the actual count of arguments.
-- `[out] argv`: Buffer to which the `napi_value` representing the
+* `[out] argv`: Buffer to which the `napi_value` representing the
arguments are copied. If there are more arguments than the provided
count, only the requested number of arguments are copied. If there are fewer
arguments provided than claimed, the rest of `argv` is filled with `napi_value`
values that represent `undefined`.
-- `[out] this`: Receives the JavaScript `this` argument for the call.
-- `[out] data`: Receives the data pointer for the callback.
+* `[out] this`: Receives the JavaScript `this` argument for the call.
+* `[out] data`: Receives the data pointer for the callback.
Returns `napi_ok` if the API succeeded.
@@ -3909,9 +3909,9 @@ napi_status napi_get_new_target(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] cbinfo`: The callback info passed into the callback function.
-- `[out] result`: The `new.target` of the constructor call.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] cbinfo`: The callback info passed into the callback function.
+* `[out] result`: The `new.target` of the constructor call.
Returns `napi_ok` if the API succeeded.
@@ -3932,13 +3932,13 @@ napi_status napi_new_instance(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] cons`: `napi_value` representing the JavaScript function
+* `[in] env`: The environment that the API is invoked under.
+* `[in] cons`: `napi_value` representing the JavaScript function
to be invoked as a constructor.
-- `[in] argc`: The count of elements in the `argv` array.
-- `[in] argv`: Array of JavaScript values as `napi_value`
+* `[in] argc`: The count of elements in the `argv` array.
+* `[in] argv`: Array of JavaScript values as `napi_value`
representing the arguments to the constructor.
-- `[out] result`: `napi_value` representing the JavaScript object returned,
+* `[out] result`: `napi_value` representing the JavaScript object returned,
which in this case is the constructed object.
This method is used to instantiate a new JavaScript value using a given
@@ -4032,34 +4032,34 @@ napi_status napi_define_class(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] utf8name`: Name of the JavaScript constructor function; this is
+* `[in] env`: The environment that the API is invoked under.
+* `[in] utf8name`: Name of the JavaScript constructor function; this is
not required to be the same as the C++ class name, though it is recommended
for clarity.
-- `[in] length`: The length of the `utf8name` in bytes, or `NAPI_AUTO_LENGTH`
+* `[in] length`: The length of the `utf8name` in bytes, or `NAPI_AUTO_LENGTH`
if it is null-terminated.
-- `[in] constructor`: Callback function that handles constructing instances
+* `[in] constructor`: Callback function that handles constructing instances
of the class. (This should be a static method on the class, not an actual
C++ constructor function.)
-- `[in] data`: Optional data to be passed to the constructor callback as
+* `[in] data`: Optional data to be passed to the constructor callback as
the `data` property of the callback info.
-- `[in] property_count`: Number of items in the `properties` array argument.
-- `[in] properties`: Array of property descriptors describing static and
+* `[in] property_count`: Number of items in the `properties` array argument.
+* `[in] properties`: Array of property descriptors describing static and
instance data properties, accessors, and methods on the class
See `napi_property_descriptor`.
-- `[out] result`: A `napi_value` representing the constructor function for
+* `[out] result`: A `napi_value` representing the constructor function for
the class.
Returns `napi_ok` if the API succeeded.
Defines a JavaScript class that corresponds to a C++ class, including:
-- A JavaScript constructor function that has the class name and invokes the
+* A JavaScript constructor function that has the class name and invokes the
provided C++ constructor callback.
-- Properties on the constructor function corresponding to _static_ data
+* Properties on the constructor function corresponding to _static_ data
properties, accessors, and methods of the C++ class (defined by
property descriptors with the `napi_static` attribute).
-- Properties on the constructor function's `prototype` object corresponding to
+* Properties on the constructor function's `prototype` object corresponding to
_non-static_ data properties, accessors, and methods of the C++ class
(defined by property descriptors without the `napi_static` attribute).
@@ -4095,16 +4095,16 @@ napi_status napi_wrap(napi_env env,
napi_ref* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] js_object`: The JavaScript object that will be the wrapper for the
+* `[in] env`: The environment that the API is invoked under.
+* `[in] js_object`: The JavaScript object that will be the wrapper for the
native object.
-- `[in] native_object`: The native instance that will be wrapped in the
+* `[in] native_object`: The native instance that will be wrapped in the
JavaScript object.
-- `[in] finalize_cb`: Optional native callback that can be used to free the
+* `[in] finalize_cb`: Optional native callback that can be used to free the
native instance when the JavaScript object is ready for garbage-collection.
-- `[in] finalize_hint`: Optional contextual hint that is passed to the
+* `[in] finalize_hint`: Optional contextual hint that is passed to the
finalize callback.
-- `[out] result`: Optional reference to the wrapped object.
+* `[out] result`: Optional reference to the wrapped object.
Returns `napi_ok` if the API succeeded.
@@ -4149,9 +4149,9 @@ napi_status napi_unwrap(napi_env env,
void** result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] js_object`: The object associated with the native instance.
-- `[out] result`: Pointer to the wrapped native instance.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] js_object`: The object associated with the native instance.
+* `[out] result`: Pointer to the wrapped native instance.
Returns `napi_ok` if the API succeeded.
@@ -4176,9 +4176,9 @@ napi_status napi_remove_wrap(napi_env env,
void** result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] js_object`: The object associated with the native instance.
-- `[out] result`: Pointer to the wrapped native instance.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] js_object`: The object associated with the native instance.
+* `[out] result`: Pointer to the wrapped native instance.
Returns `napi_ok` if the API succeeded.
@@ -4202,16 +4202,16 @@ napi_status napi_add_finalizer(napi_env env,
napi_ref* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] js_object`: The JavaScript object to which the native data will be
+* `[in] env`: The environment that the API is invoked under.
+* `[in] js_object`: The JavaScript object to which the native data will be
attached.
-- `[in] native_object`: The native data that will be attached to the JavaScript
+* `[in] native_object`: The native data that will be attached to the JavaScript
object.
-- `[in] finalize_cb`: Native callback that will be used to free the
+* `[in] finalize_cb`: Native callback that will be used to free the
native data when the JavaScript object is ready for garbage-collection.
-- `[in] finalize_hint`: Optional contextual hint that is passed to the
+* `[in] finalize_hint`: Optional contextual hint that is passed to the
finalize callback.
-- `[out] result`: Optional reference to the JavaScript object.
+* `[out] result`: Optional reference to the JavaScript object.
Returns `napi_ok` if the API succeeded.
@@ -4306,20 +4306,20 @@ napi_status napi_create_async_work(napi_env env,
napi_async_work* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] async_resource`: An optional object associated with the async work
+* `[in] env`: The environment that the API is invoked under.
+* `[in] async_resource`: An optional object associated with the async work
that will be passed to possible `async_hooks` [`init` hooks][].
-- `[in] async_resource_name`: Identifier for the kind of resource that is
+* `[in] async_resource_name`: Identifier for the kind of resource that is
being provided for diagnostic information exposed by the `async_hooks` API.
-- `[in] execute`: The native function which should be called to execute
+* `[in] execute`: The native function which should be called to execute
the logic asynchronously. The given function is called from a worker pool
thread and can execute in parallel with the main event loop thread.
-- `[in] complete`: The native function which will be called when the
+* `[in] complete`: The native function which will be called when the
asynchronous logic is completed or is cancelled. The given function is called
from the main event loop thread.
-- `[in] data`: User-provided data context. This will be passed back into the
+* `[in] data`: User-provided data context. This will be passed back into the
execute and complete functions.
-- `[out] result`: `napi_async_work*` which is the handle to the newly created
+* `[out] result`: `napi_async_work*` which is the handle to the newly created
async work.
Returns `napi_ok` if the API succeeded.
@@ -4346,8 +4346,8 @@ napi_status napi_delete_async_work(napi_env env,
napi_async_work work);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] work`: The handle returned by the call to `napi_create_async_work`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] work`: The handle returned by the call to `napi_create_async_work`.
Returns `napi_ok` if the API succeeded.
@@ -4366,8 +4366,8 @@ napi_status napi_queue_async_work(napi_env env,
napi_async_work work);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] work`: The handle returned by the call to `napi_create_async_work`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] work`: The handle returned by the call to `napi_create_async_work`.
Returns `napi_ok` if the API succeeded.
@@ -4386,8 +4386,8 @@ napi_status napi_cancel_async_work(napi_env env,
napi_async_work work);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] work`: The handle returned by the call to `napi_create_async_work`.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] work`: The handle returned by the call to `napi_create_async_work`.
Returns `napi_ok` if the API succeeded.
@@ -4419,13 +4419,13 @@ napi_status napi_async_init(napi_env env,
napi_async_context* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] async_resource`: An optional object associated with the async work
+* `[in] env`: The environment that the API is invoked under.
+* `[in] async_resource`: An optional object associated with the async work
that will be passed to possible `async_hooks` [`init` hooks][].
-- `[in] async_resource_name`: Identifier for the kind of resource
+* `[in] async_resource_name`: Identifier for the kind of resource
that is being provided for diagnostic information exposed by the
`async_hooks` API.
-- `[out] result`: The initialized async context.
+* `[out] result`: The initialized async context.
Returns `napi_ok` if the API succeeded.
@@ -4440,8 +4440,8 @@ napi_status napi_async_destroy(napi_env env,
napi_async_context async_context);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] async_context`: The async context to be destroyed.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] async_context`: The async context to be destroyed.
Returns `napi_ok` if the API succeeded.
@@ -4466,19 +4466,19 @@ napi_status napi_make_callback(napi_env env,
napi_value* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] async_context`: Context for the async operation that is
+* `[in] env`: The environment that the API is invoked under.
+* `[in] async_context`: Context for the async operation that is
invoking the callback. This should normally be a value previously
obtained from [`napi_async_init`][]. However `NULL` is also allowed,
which indicates the current async context (if any) is to be used
for the callback.
-- `[in] recv`: The `this` object passed to the called function.
-- `[in] func`: `napi_value` representing the JavaScript function
+* `[in] recv`: The `this` object passed to the called function.
+* `[in] func`: `napi_value` representing the JavaScript function
to be invoked.
-- `[in] argc`: The count of elements in the `argv` array.
-- `[in] argv`: Array of JavaScript values as `napi_value`
+* `[in] argc`: The count of elements in the `argv` array.
+* `[in] argv`: Array of JavaScript values as `napi_value`
representing the arguments to the function.
-- `[out] result`: `napi_value` representing the JavaScript object returned.
+* `[out] result`: `napi_value` representing the JavaScript object returned.
Returns `napi_ok` if the API succeeded.
@@ -4508,13 +4508,13 @@ NAPI_EXTERN napi_status napi_open_callback_scope(napi_env env,
napi_callback_scope* result)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] resource_object`: An object associated with the async work
+* `[in] env`: The environment that the API is invoked under.
+* `[in] resource_object`: An object associated with the async work
that will be passed to possible `async_hooks` [`init` hooks][].
-- `[in] context`: Context for the async operation that is
+* `[in] context`: Context for the async operation that is
invoking the callback. This should be a value previously obtained
from [`napi_async_init`][].
-- `[out] result`: The newly created scope.
+* `[out] result`: The newly created scope.
There are cases (for example, resolving promises) where it is
necessary to have the equivalent of the scope associated with a callback
@@ -4534,8 +4534,8 @@ NAPI_EXTERN napi_status napi_close_callback_scope(napi_env env,
napi_callback_scope scope)
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] scope`: The scope to be closed.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] scope`: The scope to be closed.
This API can be called even if there is a pending JavaScript exception.
@@ -4559,8 +4559,8 @@ napi_status napi_get_node_version(napi_env env,
const napi_node_version** version);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] version`: A pointer to version information for Node.js itself.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] version`: A pointer to version information for Node.js itself.
Returns `napi_ok` if the API succeeded.
@@ -4581,8 +4581,8 @@ napi_status napi_get_version(napi_env env,
uint32_t* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] result`: The highest version of N-API supported.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] result`: The highest version of N-API supported.
Returns `napi_ok` if the API succeeded.
@@ -4614,10 +4614,10 @@ NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env,
int64_t* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] change_in_bytes`: The change in externally allocated memory that is
+* `[in] env`: The environment that the API is invoked under.
+* `[in] change_in_bytes`: The change in externally allocated memory that is
kept alive by JavaScript objects.
-- `[out] result`: The adjusted value
+* `[out] result`: The adjusted value
Returns `napi_ok` if the API succeeded.
@@ -4697,11 +4697,11 @@ napi_status napi_create_promise(napi_env env,
napi_value* promise);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] deferred`: A newly created deferred object which can later be passed to
+* `[in] env`: The environment that the API is invoked under.
+* `[out] deferred`: A newly created deferred object which can later be passed to
`napi_resolve_deferred()` or `napi_reject_deferred()` to resolve resp. reject
the associated promise.
-- `[out] promise`: The JavaScript promise associated with the deferred object.
+* `[out] promise`: The JavaScript promise associated with the deferred object.
Returns `napi_ok` if the API succeeded.
@@ -4719,9 +4719,9 @@ napi_status napi_resolve_deferred(napi_env env,
napi_value resolution);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] deferred`: The deferred object whose associated promise to resolve.
-- `[in] resolution`: The value with which to resolve the promise.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] deferred`: The deferred object whose associated promise to resolve.
+* `[in] resolution`: The value with which to resolve the promise.
This API resolves a JavaScript promise by way of the deferred object
with which it is associated. Thus, it can only be used to resolve JavaScript
@@ -4744,9 +4744,9 @@ napi_status napi_reject_deferred(napi_env env,
napi_value rejection);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] deferred`: The deferred object whose associated promise to resolve.
-- `[in] rejection`: The value with which to reject the promise.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] deferred`: The deferred object whose associated promise to resolve.
+* `[in] rejection`: The value with which to reject the promise.
This API rejects a JavaScript promise by way of the deferred object
with which it is associated. Thus, it can only be used to reject JavaScript
@@ -4769,9 +4769,9 @@ napi_status napi_is_promise(napi_env env,
bool* is_promise);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] promise`: The promise to examine
-- `[out] is_promise`: Flag indicating whether `promise` is a native promise
+* `[in] env`: The environment that the API is invoked under.
+* `[in] promise`: The promise to examine
+* `[out] is_promise`: Flag indicating whether `promise` is a native promise
object - that is, a promise object created by the underlying engine.
## Script execution
@@ -4791,9 +4791,9 @@ NAPI_EXTERN napi_status napi_run_script(napi_env env,
napi_value* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] script`: A JavaScript string containing the script to execute.
-- `[out] result`: The value resulting from having executed the script.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] script`: A JavaScript string containing the script to execute.
+* `[out] result`: The value resulting from having executed the script.
## libuv event loop
@@ -4813,8 +4813,8 @@ NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env,
uv_loop_t** loop);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[out] loop`: The current libuv loop instance.
+* `[in] env`: The environment that the API is invoked under.
+* `[out] loop`: The current libuv loop instance.
<!-- it's very convenient to have all the anchors indexed -->
<!--lint disable no-unused-definitions remark-lint-->
@@ -4951,27 +4951,27 @@ napi_create_threadsafe_function(napi_env env,
napi_threadsafe_function* result);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] func`: An optional JavaScript function to call from another thread.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] func`: An optional JavaScript function to call from another thread.
It must be provided if `NULL` is passed to `call_js_cb`.
-- `[in] async_resource`: An optional object associated with the async work that
+* `[in] async_resource`: An optional object associated with the async work that
will be passed to possible `async_hooks` [`init` hooks][].
-- `[in] async_resource_name`: A JavaScript string to provide an identifier for
+* `[in] async_resource_name`: A JavaScript string to provide an identifier for
the kind of resource that is being provided for diagnostic information exposed
by the `async_hooks` API.
-- `[in] max_queue_size`: Maximum size of the queue. `0` for no limit.
-- `[in] initial_thread_count`: The initial number of threads, including the main
+* `[in] max_queue_size`: Maximum size of the queue. `0` for no limit.
+* `[in] initial_thread_count`: The initial number of threads, including the main
thread, which will be making use of this function.
-- `[in] thread_finalize_data`: Optional data to be passed to `thread_finalize_cb`.
-- `[in] thread_finalize_cb`: Optional function to call when the
+* `[in] thread_finalize_data`: Optional data to be passed to `thread_finalize_cb`.
+* `[in] thread_finalize_cb`: Optional function to call when the
`napi_threadsafe_function` is being destroyed.
-- `[in] context`: Optional data to attach to the resulting
+* `[in] context`: Optional data to attach to the resulting
`napi_threadsafe_function`.
-- `[in] call_js_cb`: Optional callback which calls the JavaScript function in
+* `[in] call_js_cb`: Optional callback which calls the JavaScript function in
response to a call on a different thread. This callback will be called on the
main thread. If not given, the JavaScript function will be called with no
parameters and with `undefined` as its `this` value.
-- `[out] result`: The asynchronous thread-safe JavaScript function.
+* `[out] result`: The asynchronous thread-safe JavaScript function.
### napi_get_threadsafe_function_context
@@ -4986,8 +4986,8 @@ napi_get_threadsafe_function_context(napi_threadsafe_function func,
void** result);
```
-- `[in] func`: The thread-safe function for which to retrieve the context.
-- `[out] result`: The location where to store the context.
+* `[in] func`: The thread-safe function for which to retrieve the context.
+* `[out] result`: The location where to store the context.
This API may be called from any thread which makes use of `func`.
@@ -5005,10 +5005,10 @@ napi_call_threadsafe_function(napi_threadsafe_function func,
napi_threadsafe_function_call_mode is_blocking);
```
-- `[in] func`: The asynchronous thread-safe JavaScript function to invoke.
-- `[in] data`: Data to send into JavaScript via the callback `call_js_cb`
+* `[in] func`: The asynchronous thread-safe JavaScript function to invoke.
+* `[in] data`: Data to send into JavaScript via the callback `call_js_cb`
provided during the creation of the thread-safe JavaScript function.
-- `[in] is_blocking`: Flag whose value can be either `napi_tsfn_blocking` to
+* `[in] is_blocking`: Flag whose value can be either `napi_tsfn_blocking` to
indicate that the call should block if the queue is full or
`napi_tsfn_nonblocking` to indicate that the call should return immediately with
a status of `napi_queue_full` whenever the queue is full.
@@ -5031,7 +5031,7 @@ NAPI_EXTERN napi_status
napi_acquire_threadsafe_function(napi_threadsafe_function func);
```
-- `[in] func`: The asynchronous thread-safe JavaScript function to start making
+* `[in] func`: The asynchronous thread-safe JavaScript function to start making
use of.
A thread should call this API before passing `func` to any other thread-safe
@@ -5054,9 +5054,9 @@ napi_release_threadsafe_function(napi_threadsafe_function func,
napi_threadsafe_function_release_mode mode);
```
-- `[in] func`: The asynchronous thread-safe JavaScript function whose reference
+* `[in] func`: The asynchronous thread-safe JavaScript function whose reference
count to decrement.
-- `[in] mode`: Flag whose value can be either `napi_tsfn_release` to indicate
+* `[in] mode`: Flag whose value can be either `napi_tsfn_release` to indicate
that the current thread will make no further calls to the thread-safe function,
or `napi_tsfn_abort` to indicate that in addition to the current thread, no
other thread should make any further calls to the thread-safe function. If set
@@ -5081,8 +5081,8 @@ NAPI_EXTERN napi_status
napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] func`: The thread-safe function to reference.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] func`: The thread-safe function to reference.
This API is used to indicate that the event loop running on the main thread
should not exit until `func` has been destroyed. Similar to [`uv_ref`][] it is
@@ -5102,8 +5102,8 @@ NAPI_EXTERN napi_status
napi_unref_threadsafe_function(napi_env env, napi_threadsafe_function func);
```
-- `[in] env`: The environment that the API is invoked under.
-- `[in] func`: The thread-safe function to unreference.
+* `[in] env`: The environment that the API is invoked under.
+* `[in] func`: The thread-safe function to unreference.
This API is used to indicate that the event loop running on the main thread
may exit before `func` is destroyed. Similar to [`uv_unref`][] it is also