@@ -1331,6 +1331,40 @@ JavaScript TypedArray Objects are described in
13311331[ Section 22.2] ( https://tc39.github.io/ecma262/#sec-typedarray-objects )
13321332of the ECMAScript Language Specification.
13331333
1334+
1335+ #### * napi_create_dataview*
1336+ <!-- YAML
1337+ added: REPLACEME
1338+ -->
1339+
1340+ ``` C
1341+ napi_status napi_create_dataview (napi_env env,
1342+ size_t byte_length,
1343+ napi_value arraybuffer,
1344+ size_t byte_offset,
1345+ napi_value* result)
1346+
1347+ ```
1348+
1349+ - `[in] env`: The environment that the API is invoked under.
1350+ - `[in] length`: Number of elements in the DataView.
1351+ - `[in] arraybuffer`: ArrayBuffer underlying the DataView.
1352+ - `[in] byte_offset`: The byte offset within the ArrayBuffer from which to
1353+ start projecting the DataView.
1354+ - `[out] result`: A `napi_value` representing a JavaScript DataView.
1355+
1356+ Returns `napi_ok` if the API succeeded.
1357+
1358+ This API creates a JavaScript DataView object over an existing ArrayBuffer.
1359+ DataView objects provide an array-like view over an underlying data buffer,
1360+ but one which allows items of different size and type in the ArrayBuffer.
1361+
1362+ It is required that `byte_length + byte_offset` is less than or equal to the
1363+ size in bytes of the array passed in. If not, a RangeError exception is raised.
1364+
1365+ JavaScript DataView Objects are described in
1366+ [Section 24.3][] of the ECMAScript Language Specification.
1367+
13341368### Functions to convert from C types to N-API
13351369#### *napi_create_number*
13361370<!-- YAML
@@ -1552,6 +1586,36 @@ This API returns various properties of a typed array.
15521586* Warning* : Use caution while using this API since the underlying data buffer
15531587is managed by the VM
15541588
1589+
1590+
1591+ #### * napi_get_dataview_info*
1592+ <!-- YAML
1593+ added: REPLACEME
1594+ -->
1595+
1596+ ``` C
1597+ napi_status napi_get_dataview_info (napi_env env,
1598+ napi_value dataview,
1599+ size_t* byte_length,
1600+ void** data,
1601+ napi_value* arraybuffer,
1602+ size_t* byte_offset)
1603+ ```
1604+
1605+ - `[in] env`: The environment that the API is invoked under.
1606+ - `[in] dataview`: `napi_value` representing the DataView whose
1607+ properties to query.
1608+ - `[out] byte_length`: Number of bytes in the DataView.
1609+ - `[out] data`: The data buffer underlying the DataView.
1610+ - `[out] arraybuffer`: ArrayBuffer underlying the DataView.
1611+ - `[out] byte_offset`: The byte offset within the data buffer from which
1612+ to start projecting the DataView.
1613+
1614+ Returns `napi_ok` if the API succeeded.
1615+
1616+ This API returns various properties of a DataView.
1617+
1618+
15551619#### *napi_get_value_bool*
15561620<!-- YAML
15571621added: v8.0.0
@@ -2019,6 +2083,25 @@ Returns `napi_ok` if the API succeeded.
20192083
20202084This API checks if the Object passsed in is a typed array.
20212085
2086+
2087+
2088+ ### * napi_is_dataview*
2089+ <!-- YAML
2090+ added: REPLACEME
2091+ -->
2092+
2093+ ``` C
2094+ napi_status napi_is_dataview (napi_env env, napi_value value, bool* result)
2095+ ```
2096+
2097+ - `[in] env`: The environment that the API is invoked under.
2098+ - `[in] value`: The JavaScript value to check.
2099+ - `[out] result`: Whether the given `napi_value` represents a DataView.
2100+
2101+ Returns `napi_ok` if the API succeeded.
2102+
2103+ This API checks if the Object passed in is a DataView.
2104+
20222105### *napi_strict_equals*
20232106<!-- YAML
20242107added: v8.0.0
@@ -3165,6 +3248,7 @@ support it:
31653248[Object Wrap]: #n_api_object_wrap
31663249[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
31673250[Section 12.5.5]: https://tc39.github.io/ecma262/#sec-typeof-operator
3251+ [Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects
31683252[Working with JavaScript Functions]: #n_api_working_with_javascript_functions
31693253[Working with JavaScript Properties]: #n_api_working_with_javascript_properties
31703254[Working with JavaScript Values]: #n_api_working_with_javascript_values
0 commit comments