-
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: add more property defaults #35214
Conversation
Add a default value for class method and js like property in enum napi_property_attributes. n-api currently offers only one default which is non configurable, non writable, non enumerable - like Object.defineProperty(). While this is formal correct the usual way to create properties in JS is either by defining a class or use obj.prop = value. The defaults from these variants are now backed into enum values.
Review requested:
|
Do we need an |
@Flarna yeah, the new enum values need to be inside a #ifdef NAPI_EXPERIMENTAL
...
#endif // NAPI_EXPERIMENTAL block. |
@gabrielschulhof ok, will add the flag. I found also the napi guideline. It tells Besides that I will split the PR to move the changes in the doc samples into a separate PR to avoid that they use an experimental part. |
@Flarna in general we would like to mark things as stable when they are available in all LTS versions. I know this is a small change, but it would be best if we backported it first. We can delay landing #35199 until after our N-API meeting, wherein we can discuss whether we should first backport this and then release N-API 7 with these changes. This can land as experimental until then. @nodejs/n-api WDYT? |
This comment has been minimized.
This comment has been minimized.
@gabrielschulhof Sounds good. I expect that n-api v7 should be part of node.js 15. Not sure if we end up in hitting some deadline here. I don't want to block your changes for n-api 7 so feel free to go on with your v7 changes. |
Co-authored-by: Gabriel Schulhof <gabrielschulhof@gmail.com>
Bumping n-api version is a semver-minor change. If the consensus that this should be included in n-api v7 has been reached, I'd believe it is ok to exceed the deadline of v15.0.0 and land in a later minor version. |
Add a default value for class method and js like property in enum napi_property_attributes. n-api currently offers only one default which is non configurable, non writable, non enumerable - like Object.defineProperty(). While this is formal correct the usual way to create properties in JS is either by defining a class or use obj.prop = value. The defaults from these variants are now backed into enum values. PR-URL: #35214 Refs: nodejs/node-addon-api#811 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Landed in c9506a8 |
Add a default value for class method and js like property in
enum napi_property_attributes
.n-api currently offers only one default which is non configurable, non writable, non enumerable - like
Object.defineProperty()
. While this is formal correct the usual way to create properties in JS is either by defining a class or useobj.prop = value
.The defaults from these variants are now backed into enum values.
Refs: nodejs/node-addon-api#811