@@ -121,6 +121,26 @@ must use Node-API exclusively by restricting itself to using
121121and by checking, for all external libraries that it uses, that the external
122122library makes ABI stability guarantees similar to Node-API.
123123
124+ ### Enum values in ABI stability
125+
126+ All enum data types defined in Node-API should be considered as a fixed size
127+ `int32_t` value. Bit flag enum types should be explicitly documented, and they
128+ work with bit operators like bit-OR (`|`) as a bit value. Unless otherwise
129+ documented, an enum type should be considered to be extensible.
130+
131+ An enum value will not be removed or renamed.
132+
133+ For an enum type returned from a Node-API function, or provided as an out
134+ parameter of a Node-API function, the value is an integer value and an addon
135+ should handle unknown values. For example, when checking `napi_status` in
136+ switch statements, an addon should include a default branch, as new status
137+ codes may be introduced in newer Node.js versions
138+
139+ For an enum type used in an in-parameter, the result of passing an unknown
140+ integer value to Node-API functions is undefined unless otherwise documented.
141+ For example, `napi_get_all_property_names` can be extended with new enum value
142+ of `napi_key_filter`.
143+
124144## Building
125145
126146Unlike modules written in JavaScript, developing and deploying Node.js
@@ -2203,7 +2223,7 @@ typedef enum {
22032223} napi_key_filter;
22042224```
22052225
2206- Property filter bits. They can be or'ed to build a composite filter.
2226+ Property filter bit flag. This works with bit operators to build a composite filter.
22072227
22082228#### `napi_key_conversion`
22092229
@@ -4417,11 +4437,11 @@ typedef enum {
44174437} napi_property_attributes;
44184438```
44194439
4420- `napi_property_attributes` are flags used to control the behavior of properties
4421- set on a JavaScript object. Other than `napi_static` they correspond to the
4422- attributes listed in [Section property attributes][]
4440+ `napi_property_attributes` are bit flags used to control the behavior of
4441+ properties set on a JavaScript object. Other than `napi_static` they
4442+ correspond to the attributes listed in [Section property attributes][]
44234443of the [ECMAScript Language Specification][].
4424- They can be one or more of the following bitflags :
4444+ They can be one or more of the following bit flags :
44254445
44264446* `napi_default`: No explicit attributes are set on the property. By default, a
44274447 property is read only, not enumerable and not configurable.
0 commit comments