doc: fix doc for napi_get_typedarray_info

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: https://github.com/nodejs/node/pull/20747
Fixes: https://github.com/nodejs/node-addon-api/issues/244
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Michael Dawson 2018-05-15 10:57:30 -04:00
parent 5624a6f8a7
commit 35cf00842f

View File

@ -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.