SharedArrayBuffer

Class Napi::SharedArrayBuffer inherits from class Napi::ArrayBufferLike.

The Napi::SharedArrayBuffer class corresponds to the JavaScript SharedArrayBuffer class.

NOTE: The support for Napi::SharedArrayBuffer is only available when using NAPI_EXPERIMENTAL and building against Node.js headers that support this feature.

Methods

New

Allocates a new Napi::SharedArrayBuffer instance with a given length.

static Napi::SharedArrayBuffer Napi::SharedArrayBuffer::New(napi_env env, size_t byteLength);
  • [in] env: The environment in which to create the Napi::SharedArrayBuffer instance.
  • [in] byteLength: The length to be allocated, in bytes.

Returns a new Napi::SharedArrayBuffer instance.

Constructor

Initializes an empty instance of the Napi::SharedArrayBuffer class.

Napi::SharedArrayBuffer::SharedArrayBuffer();

Constructor

Initializes a wrapper instance of an existing Napi::SharedArrayBuffer object.

Napi::SharedArrayBuffer::SharedArrayBuffer(napi_env env, napi_value value);
  • [in] env: The environment in which to create the Napi::SharedArrayBuffer instance.
  • [in] value: The Napi::SharedArrayBuffer reference to wrap.