Skip to content

Commit 03c4ee9

Browse files
Flarnamhdawson
authored andcommitted
doc: update napi_make_callback documentation
Calling napi_make_callback() with no async_context is not resulting in using the current async context instead an empty context (id 0) is used. Using NULL is like using node::Makecallback without async_context which is deprecated since Node.js 10 (DEP0099). PR-URL: #35321 Fixes: #35188 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 109a296 commit 03c4ee9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/api/n-api.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -5180,9 +5180,11 @@ NAPI_EXTERN napi_status napi_make_callback(napi_env env,
51805180
* `[in] env`: The environment that the API is invoked under.
51815181
* `[in] async_context`: Context for the async operation that is
51825182
invoking the callback. This should normally be a value previously
5183-
obtained from [`napi_async_init`][]. However `NULL` is also allowed,
5184-
which indicates the current async context (if any) is to be used
5185-
for the callback.
5183+
obtained from [`napi_async_init`][].
5184+
In order to retain ABI compatibility with previous versions, passing `NULL`
5185+
for `async_context` will not result in an error. However, this will result
5186+
in incorrect operation of async hooks. Potential issues include loss of
5187+
async context when using the `AsyncLocalStorage` API.
51865188
* `[in] recv`: The `this` object passed to the called function.
51875189
* `[in] func`: `napi_value` representing the JavaScript function to be invoked.
51885190
* `[in] argc`: The count of elements in the `argv` array.

0 commit comments

Comments
 (0)