Skip to content

Commit 8d6203f

Browse files
committed
doc: amplify warning for execute callback
Add specific recommendation not to use the to the napi-env parameter in napi_async_execute_callback
1 parent 54fcb14 commit 8d6203f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

doc/api/n-api.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,10 @@ typedef void (*napi_async_execute_callback)(napi_env env, void* data);
462462
Implementations of this type of function should avoid making any N-API calls
463463
that could result in the execution of JavaScript or interaction with
464464
JavaScript objects. Most often, any code that needs to make N-API
465-
calls should be made in `napi_async_complete_callback` instead.
465+
calls should be made in `napi_async_complete_callback` instead. The
466+
current recommendation is to avoid all usage of the
467+
napi_env parameter in the execute callback as it will most
468+
likely cause JavaScript to be executed.
466469

467470
#### napi_async_complete_callback
468471
<!-- YAML
@@ -4027,7 +4030,10 @@ task respectively.
40274030
The `execute` function should avoid making any N-API calls
40284031
that could result in the execution of JavaScript or interaction with
40294032
JavaScript objects. Most often, any code that needs to make N-API
4030-
calls should be made in `complete` callback instead.
4033+
calls should be made in `complete` callback instead. The
4034+
current recommendation is to avoid all usage of the
4035+
napi_env parameter in the execute callback as it will most
4036+
likely cause JavaScript to be executed.
40314037

40324038
These functions implement the following interfaces:
40334039

0 commit comments

Comments
 (0)