diff options
author | Gerhard Stoebich <18708370+Flarna@users.noreply.github.com> | 2020-09-24 00:28:31 +0300 |
---|---|---|
committer | Michael Dawson <mdawson@devrus.com> | 2020-09-25 23:56:13 +0300 |
commit | 03c4ee91d003da2a6ff4c19b91c7c7dafa705a55 (patch) | |
tree | 36874ae4546ff787bd2d4fca239d491cfddefa2d /doc/api/n-api.md | |
parent | 109a296e2ad15221b89a33efec9ba3ff56df3d27 (diff) |
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: https://github.com/nodejs/node/pull/35321
Fixes: https://github.com/nodejs/node/issues/35188
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r-- | doc/api/n-api.md | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md index dc991a0a5bc..6356700daba 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -5180,9 +5180,11 @@ NAPI_EXTERN napi_status napi_make_callback(napi_env env, * `[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. + obtained from [`napi_async_init`][]. + In order to retain ABI compatibility with previous versions, passing `NULL` + for `async_context` will not result in an error. However, this will result + in incorrect operation of async hooks. Potential issues include loss of + async context when using the `AsyncLocalStorage` API. * `[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. |