| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c3e1bf7 commit d938e85
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3643,6 +3643,12 @@ if (status != napi_ok) return status; | |||
| 3643 | 3643 | ||
| 3644 | 3644 | ### Structures | |
| 3645 | 3645 | #### napi_property_attributes | |
| 3646 | + <!-- YAML | ||
| 3647 | + changes: | ||
| 3648 | + - version: REPLACEME | ||
| 3649 | + pr-url: https://github.com/nodejs/node/pull/35214 | ||
| 3650 | + description: added `napi_default_method` and `napi_default_property` | ||
| 3651 | + --> | ||
| 3646 | 3652 | ||
| 3647 | 3653 | ```c | |
| 3648 | 3654 | typedef enum { | |
@@ -3654,6 +3660,14 @@ typedef enum { | |||
| 3654 | 3660 | // Used with napi_define_class to distinguish static properties | |
| 3655 | 3661 | // from instance properties. Ignored by napi_define_properties. | |
| 3656 | 3662 | napi_static = 1 << 10, | |
| 3663 | + | ||
| 3664 | + // Default for class methods. | ||
| 3665 | + napi_default_method = napi_writable | napi_configurable, | ||
| 3666 | + | ||
| 3667 | + // Default for object properties, like in JS obj[prop]. | ||
| 3668 | + napi_default_property = napi_writable | | ||
| 3669 | + napi_enumerable | | ||
| 3670 | + napi_configurable, | ||
| 3657 | 3671 | } napi_property_attributes; | |
| 3658 | 3672 | ``` | |
| 3659 | 3673 | ||
@@ -3672,6 +3686,10 @@ They can be one or more of the following bitflags: | |||
| 3672 | 3686 | * `napi_static`: The property will be defined as a static property on a class as | |
| 3673 | 3687 | opposed to an instance property, which is the default. This is used only by | |
| 3674 | 3688 | [`napi_define_class`][]. It is ignored by `napi_define_properties`. | |
| 3689 | + * `napi_default_method`: The property is configureable, writeable but not | ||
| 3690 | + enumerable like a method in a JS class. | ||
| 3691 | + * `napi_default_property`: The property is writable, enumerable and configurable | ||
| 3692 | + like a property set via JS code `obj.key = value`. | ||
| 3675 | 3693 | ||
| 3676 | 3694 | #### napi_property_descriptor | |
| 3677 | 3695 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,16 @@ typedef enum { | |||
| 30 | 30 | // Used with napi_define_class to distinguish static properties | |
| 31 | 31 | // from instance properties. Ignored by napi_define_properties. | |
| 32 | 32 | napi_static = 1 << 10, | |
| 33 | + | ||
| 34 | + #ifdef NAPI_EXPERIMENTAL | ||
| 35 | + // Default for class methods. | ||
| 36 | + napi_default_method = napi_writable | napi_configurable, | ||
| 37 | + | ||
| 38 | + // Default for object properties, like in JS obj[prop]. | ||
| 39 | + napi_default_jsproperty = napi_writable | | ||
| 40 | + napi_enumerable | | ||
| 41 | + napi_configurable, | ||
| 42 | + #endif // NAPI_EXPERIMENTAL | ||
| 33 | 43 | } napi_property_attributes; | |
| 34 | 44 | ||
| 35 | 45 | typedef enum { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments