Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N api dataview #14382

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
Fix typos and alignment
  • Loading branch information
shivanth committed Jul 20, 2017
commit 5fc5ffb891fc444ce6f63a20a4c98b4d6a8f450f
38 changes: 20 additions & 18 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1334,22 +1334,23 @@ of the ECMAScript Language Specification.

#### *napi_create_dataview*
<!-- YAML
added: v8.0.0
added: REPLACEME
-->

```C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave a newline before this?

napi_status napi_create_dataview(napi_env env,
size_t length,
napi_value arraybuffer,
size_t byte_offset,
napi_value* result)
size_t length,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

length should be byte_length for clarity.

napi_value arraybuffer,
size_t byte_offset,
napi_value* result)

```

- `[in] env`: The environment that the API is invoked under.
- `[in] length`: Number of elements in the DataView.
- `[in] arraybuffer`: ArrayBuffer underlying the DataView.
- `[in] byte_offset`: The byte offset within the ArrayBuffer from which to
start projecting the DataVIew.
start projecting the DataView.
- `[out] result`: A `napi_value` representing a JavaScript DataView.

Returns `napi_ok` if the API succeeded.
Expand Down Expand Up @@ -1588,31 +1589,31 @@ is managed by the VM

#### *napi_get_dataview_info*
<!-- YAML
added: v8.0.0
added: REPLACEME
-->

```C
napi_status napi_get_dataview_info(napi_env env,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comments here

napi_value dataview,
size_t* bytelength,
void** data,
napi_value* arraybuffer,
size_t* byte_offset)
napi_value dataview,
size_t* bytelength,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

byte_length for consistency with other functions.

void** data,
napi_value* arraybuffer,
size_t* byte_offset)
```

- `[in] env`: The environment that the API is invoked under.
- `[in] dataview`: `napi_value` representing the DataView whose
properties to query.
- `[out] length`: Number of elements in the DataView.
properties to query.
- `[out] bytelength`: Number of bytes in the DataView.
- `[out] data`: The data buffer underlying the DataView.
- `[out] arraybuffer`: ArrayBuffer underlying the DataView.
- `[out] byte_offset`: The byte offset within the data buffer from which
to start projecting the DataView.
to start projecting the DataView.

Returns `napi_ok` if the API succeeded.

This API returns various properties of a DataView.

*Warning*: Use caution while using this API since the underlying data buffer
is managed by the VM

#### *napi_get_value_bool*
<!-- YAML
Expand Down Expand Up @@ -2087,6 +2088,7 @@ This API checks if the Object passsed in is a typed array.
<!-- YAML
added: v8.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REPLACEME here too please.

-->

```C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ditto)

napi_status napi_is_dataview(napi_env env, napi_value value, bool* result)
```
Expand All @@ -2097,7 +2099,7 @@ napi_status napi_is_dataview(napi_env env, napi_value value, bool* result)

Returns `napi_ok` if the API succeeded.

This API checks if the Object passsed in is a dataview.
This API checks if the Object passsed in is a DataView.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: passsed.


### *napi_strict_equals*
<!-- YAML
Expand Down