Skip to content

doc: NAPI `napi_open_callback_scope`

  • parameter resource_object is mandatory
Checklist

Description

According to documention napi_open_callback_scope's parameter resource_object is optional.

[in] resource_object: An optional object associated with the async work that will be passed to possible async_hooks init hooks.

, but when I do this:

status = napi_open_callback_scope(env, nullptr, async_context, &scope);

I get napi_invalid_arg and when I do this:

status = napi_open_callback_scope(env, resource_object, async_context, &scope);

it's napi_ok, so I checked impl and found this in node_api.cc:

v8::Local<v8::Object> resource;
CHECK_TO_OBJECT(env, context, resource, resource_object);

which makes me think that documentation is wrong, so here the PR for documentation.

Merge request reports

Loading