-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
N-API documentation needs review (misleading / wrong code samples, etc) #20421
Comments
Thank you. I will fix cc @nodejs/n-api @nodejs/documentation |
PR to cleanup all by the modules section and the 'be associated with the error' which @vsemozhetbyt mentioned he is looking at: #20430 Will look at the modules section next. |
@josephg thanks for the comments/suggestions for cleanup. |
#20433 fixes the |
|
Partial doc cleanup as per nodejs#20421
Partial doc cleanup as per #20421 PR-URL: #20430 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Partial doc cleanup as per #20421 PR-URL: #20430 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Partial doc cleanup as per #20421 PR-URL: #20430 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Partial doc cleanup as per #20421 PR-URL: #20430 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Partial doc cleanup as per #20421 PR-URL: #20430 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Partial doc cleanup as per #20421 PR-URL: #20430 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
has this been resolved? |
Yes! Thanks everyone |
I've been reading the N-API docs to understand it and it needs some cleanup. I'm not sure if all of these notes are still an issue in master.
I also somewhere saw a line which was missing its
;
, and now I can't find it.N-API
napi_status
napi_create_error
Making handle lifespan shorter ...
e
->env
. Likewise in the second example in this block, where the environment is referred to asenv
in calls to some methods but notnapi_get_element
.Module registration:
status
is checked before it is assignednapi_property_descriptor
fields are (utf8name
,name
,method
,getter
,setter
,value
,attr
,data
). There are 8 of them, not 7. Unless I'm missing something, the code should be{"hello", 0, Method, 0, 0, 0, napi_default, 0}
. But imho it should useNULL
instead of 0. In modern C I would simply write this as{.utf8name="hello", .method=Method}
,although I'm not sure if the VC++ compiler can handle struct property initializers yet.The internet says yesdesc
an array ofnapi_property_descriptor
objects. Although the class example does that... so maybe its not super important.{ "value", NULL, 0, GetValue, SetValue, 0, napi_default, 0 },
.DECLARE_NAPI_METHOD
is not a real thing - it does not exist anywhere else in the documentation or header files. This example should either define it locally or not use it.napi_property_descriptor
data
andattributes
fields should be swappedThe text was updated successfully, but these errors were encountered: