Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: amplify warning for execute callback #28738

Closed
wants to merge 5 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,9 @@ typedef void (*napi_async_execute_callback)(napi_env env, void* data);
Implementations of this type of function should avoid making any N-API calls
that could result in the execution of JavaScript or interaction with
JavaScript objects. Most often, any code that needs to make N-API
calls should be made in `napi_async_complete_callback` instead.
calls should be made in `napi_async_complete_callback` instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
calls should be made in `napi_async_complete_callback` instead.
calls should be made in `napi_async_complete_callback` instead.

Avoid using the `napi_env` parameter in the execute callback as
it will likely execute JavaScript.

#### napi_async_complete_callback
<!-- YAML
Expand Down Expand Up @@ -4027,7 +4029,9 @@ task respectively.
The `execute` function should avoid making any N-API calls
that could result in the execution of JavaScript or interaction with
JavaScript objects. Most often, any code that needs to make N-API
calls should be made in `complete` callback instead.
calls should be made in `complete` callback instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
calls should be made in `complete` callback instead.
calls should be made in `complete` callback instead.

Avoid using the `napi_env` parameter in the execute callback as
it will likely execute JavaScript.

These functions implement the following interfaces:

Expand Down