@@ -1560,25 +1560,6 @@ is passed in it returns `napi_number_expected`.
1560
1560
This API returns the C int64 primitive equivalent of the given
1561
1561
JavaScript Number
1562
1562
1563
- #### *napi_get_value_string_length*
1564
- <!-- YAML
1565
- added: v8.0.0
1566
- -->
1567
- ```C
1568
- napi_status napi_get_value_string_length(napi_env env,
1569
- napi_value value,
1570
- int* result)
1571
- ```
1572
-
1573
- - ` [in] env ` : The environment that the API is invoked under.
1574
- - ` [in] value ` : ` napi_value ` representing JavaScript string.
1575
- - ` [out] result ` : Number of characters in the given JavaScript string.
1576
-
1577
- Returns ` napi_ok ` if the API succeeded. If a non-String ` napi_value `
1578
- is passed in it returns ` napi_string_expected ` .
1579
-
1580
- This API returns the number of characters in the given JavaScript string.
1581
-
1582
1563
#### *napi_get_value_string_utf8*
1583
1564
<!-- YAML
1584
1565
added: v8.0.0
@@ -2100,39 +2081,42 @@ if (status != napi_ok) return status;
2100
2081
``` C
2101
2082
typedef enum {
2102
2083
napi_default = 0,
2103
- napi_read_only = 1 << 0,
2104
- napi_dont_enum = 1 << 1,
2105
- napi_dont_delete = 1 << 2,
2106
- napi_static_property = 1 << 10,
2084
+ napi_writable = 1 << 0,
2085
+ napi_enumerable = 1 << 1,
2086
+ napi_configurable = 1 << 2,
2087
+
2088
+ // Used with napi_define_class to distinguish static properties
2089
+ // from instance properties. Ignored by napi_define_properties.
2090
+ napi_static = 1 << 10,
2107
2091
} napi_property_attributes;
2108
2092
```
2109
2093
2110
2094
` napi_property_attributes ` are flags used to control the behavior of properties
2111
- set on a JavaScript object. They roughly correspond to the attributes listed in
2112
- [ Section 6.1.7.1] ( https://tc39.github.io/ecma262/#table-2 ) of the
2113
- [ ECMAScript Language Specification] ( https://tc39.github.io/ecma262/ ) . They can
2114
- be one or more of the following bitflags:
2095
+ set on a JavaScript object. Other than ` napi_static ` they correspond to the
2096
+ attributes listed in [ Section 6.1.7.1] ( https://tc39.github.io/ecma262/#table-2 )
2097
+ of the [ ECMAScript Language Specification] ( https://tc39.github.io/ecma262/ ) .
2098
+ They can be one or more of the following bitflags:
2115
2099
2116
2100
- ` napi_default ` - Used to indicate that no explicit attributes are set on the
2117
- given property. By default, a property is Writable, Enumerable, and
2118
- Configurable. This is a deviation from the ECMAScript specification,
2119
- where generally the values for a property descriptor attribute default to
2120
- false if they're not provided.
2121
- - ` napi_read_only ` - Used to indicate that a given property is not Writable.
2122
- - ` napi_dont_enum ` - Used to indicate that a given property is not Enumerable.
2123
- - ` napi_dont_delete ` - Used to indicate that a given property is not.
2124
- Configurable, as defined in
2101
+ given property. By default, a property is read only, not enumerable and not
2102
+ configurable.
2103
+ - ` napi_writable ` - Used to indicate that a given property is writable.
2104
+ - ` napi_enumerable ` - Used to indicate that a given property is enumerable.
2105
+ - ` napi_configurable ` - Used to indicate that a given property is
2106
+ configurable, as defined in
2125
2107
[ Section 6.1.7.1] ( https://tc39.github.io/ecma262/#table-2 ) of the
2126
2108
[ ECMAScript Language Specification] ( https://tc39.github.io/ecma262/ ) .
2127
- - ` napi_static_property ` - Used to indicate that the property will be defined as
2109
+ - ` napi_static ` - Used to indicate that the property will be defined as
2128
2110
a static property on a class as opposed to an instance property, which is the
2129
2111
default. This is used only by [ ` napi_define_class ` ] [ ] . It is ignored by
2130
2112
` napi_define_properties ` .
2131
2113
2132
2114
#### * napi_property_descriptor*
2133
2115
``` C
2134
2116
typedef struct {
2117
+ // One of utf8name or name should be NULL.
2135
2118
const char* utf8name;
2119
+ napi_value name;
2136
2120
2137
2121
napi_callback method;
2138
2122
napi_callback getter;
@@ -2144,7 +2128,12 @@ typedef struct {
2144
2128
} napi_property_descriptor;
2145
2129
```
2146
2130
2147
- - ` utf8name ` : String describing the key for the property, encoded as UTF8.
2131
+ - ` utf8name ` : Optional String describing the key for the property,
2132
+ encoded as UTF8. One of ` utf8name ` or ` name ` must be provided for the
2133
+ property.
2134
+ - ` name ` : Optional napi_value that points to a JavaScript string or symbol
2135
+ to be used as the key for the property. One of ` utf8name ` or ` name ` must
2136
+ be provided for the property.
2148
2137
- ` value ` : The value that's retrieved by a get access of the property if the
2149
2138
property is a data property. If this is passed in, set ` getter ` , ` setter ` ,
2150
2139
` method ` and ` data ` to ` NULL ` (since these members won't be used).
0 commit comments