napi_property_descriptor
typejs_native_api.htypedef struct {
// One of utf8name or name should be NULL.
const char* utf8name;
napi_value name;
napi_callback method;
napi_callback getter;
napi_callback setter;
napi_value value;
napi_property_attributes attributes;
void* data;
} napi_property_descriptor;
utf8name: Optional string describing the key for the property, encoded as UTF8. One ofutf8nameornamemust be provided for the property.name: Optionalnapi_valuethat points to a JavaScript string or symbol to be used as the key for the property. One ofutf8nameornamemust be provided for the property.value: The value that's retrieved by a get access of the property if the property is a data property. If this is passed in, setgetter,setter,methodanddatatoNULL(since these members won't be used).getter: A function to call when a get access of the property is performed. If this is passed in, setvalueandmethodtoNULL(since these members won't be used). The given function is called implicitly by the runtime when the property is accessed from JavaScript code (or if a get on the property is performed using a Node-API call).napi_callbackprovides more details.setter: A function to call when a set access of the property is performed. If this is passed in, setvalueandmethodtoNULL(since these members won't be used). The given function is called implicitly by the runtime when the property is set from JavaScript code (or if a set on the property is performed using a Node-API call).napi_callbackprovides more details.method: Set this to make the property descriptor object'svalueproperty to be a JavaScript function represented bymethod. If this is passed in, setvalue,getterandsettertoNULL(since these members won't be used).napi_callbackprovides more details.attributes: The attributes associated with the particular property. Seenapi_property_attributes.data: The callback data passed intomethod,getterandsetterif this function is invoked.