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_EXPERIMENTALblock. |
|
@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