@@ -1331,6 +1331,40 @@ JavaScript TypedArray Objects are described in
1331
1331
[ Section 22.2] ( https://tc39.github.io/ecma262/#sec-typedarray-objects )
1332
1332
of the ECMAScript Language Specification.
1333
1333
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
+
1334
1368
### Functions to convert from C types to N-API
1335
1369
#### *napi_create_number*
1336
1370
<!-- YAML
@@ -1552,6 +1586,36 @@ This API returns various properties of a typed array.
1552
1586
* Warning* : Use caution while using this API since the underlying data buffer
1553
1587
is managed by the VM
1554
1588
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
+
1555
1619
#### *napi_get_value_bool*
1556
1620
<!-- YAML
1557
1621
added: v8.0.0
@@ -2019,6 +2083,25 @@ Returns `napi_ok` if the API succeeded.
2019
2083
2020
2084
This API checks if the Object passsed in is a typed array.
2021
2085
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
+
2022
2105
### *napi_strict_equals*
2023
2106
<!-- YAML
2024
2107
added: v8.0.0
@@ -3165,6 +3248,7 @@ support it:
3165
3248
[Object Wrap]: #n_api_object_wrap
3166
3249
[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
3167
3250
[Section 12.5.5]: https://tc39.github.io/ecma262/#sec-typeof-operator
3251
+ [Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects
3168
3252
[Working with JavaScript Functions]: #n_api_working_with_javascript_functions
3169
3253
[Working with JavaScript Properties]: #n_api_working_with_javascript_properties
3170
3254
[Working with JavaScript Values]: #n_api_working_with_javascript_values
0 commit comments