Skip to content

Commit

Permalink
doc: fix doc for napi_get_typedarray_info
Browse files Browse the repository at this point in the history
The data pointer returned for the typedarray has
already been adjusted by the offset so it does not
point to the start of the buffer, instead id points
to the start of the first element.

I think we probably would have liked it to point to the
start of the buffer, but we can't change as that would be
a breaking change.

Update the doc to match the implementation.

PR-URL: #20747
Fixes: nodejs/node-addon-api#244
Reviewed-By: Gabriel Schulhof <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
mhdawson authored and MylesBorins committed May 29, 2018
1 parent 0112357 commit ce13797
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1750,10 +1750,15 @@ napi_status napi_get_typedarray_info(napi_env env,
properties to query.
- `[out] type`: Scalar datatype of the elements within the `TypedArray`.
- `[out] length`: The number of elements in the `TypedArray`.
- `[out] data`: The data buffer underlying the `TypedArray`.
- `[out] data`: The data buffer underlying the `TypedArray` adjusted by
the `byte_offset` value so that it points to the first element in the
`TypedArray`.
- `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`.
- `[out] byte_offset`: The byte offset within the data buffer from which
to start projecting the `TypedArray`.
- `[out] byte_offset`: The byte offset within the underlying native array
at which the first element of the arrays is located. The value for the data
parameter has already been adjusted so that data points to the first element
in the array. Therefore, the first byte of the native array would be at
data - `byte_offset`.

Returns `napi_ok` if the API succeeded.

Expand Down

0 comments on commit ce13797

Please sign in to comment.