1. typedef enum {
    2. napi_default = 0,
    3. napi_writable = 1 << 0,
    4. napi_enumerable = 1 << 1,
    5. napi_configurable = 1 << 2,
    6. // Used with napi_define_class to distinguish static properties
    7. // from instance properties. Ignored by napi_define_properties.
    8. napi_static = 1 << 10,
    9. // Default for class methods.
    10. napi_default_method = napi_writable | napi_configurable,
    11. // Default for object properties, like in JS obj[prop].
    12. napi_default_property = napi_writable |
    13. napi_enumerable |
    14. napi_configurable,
    15. } napi_property_attributes;

    napi_property_attributes are flags used to control the behavior of properties set on a JavaScript object. Other than napi_static they correspond to the attributes listed in [Section 6.1.7.1][] of the [ECMAScript Language Specification][]. They can be one or more of the following bitflags:

    • napi_default: No explicit attributes are set on the property. By default, a property is read only, not enumerable and not configurable.
    • napi_writable: The property is writable.
    • napi_enumerable: The property is enumerable.
    • napi_configurable: The property is configurable as defined in [Section 6.1.7.1][] of the [ECMAScript Language Specification][].
    • napi_static: The property will be defined as a static property on a class as opposed to an instance property, which is the default. This is used only by [napi_define_class][]. It is ignored by napi_define_properties.
    • napi_default_method: Like a method in a JS class, the property is configurable and writeable, but not enumerable.
    • napi_default_property: Like a property set via assignment in JavaScript, the property is writable, enumerable, and configurable.