napi_detach_arraybuffer
napi_status napi_detach_arraybuffer(napi_env env,
napi_value arraybuffer)
-
[in] env
:调用 API 的环境。¥
[in] env
: The environment that the API is invoked under. -
[in] arraybuffer
:要分离的 JavaScriptArrayBuffer
。¥
[in] arraybuffer
: The JavaScriptArrayBuffer
to be detached.
如果 API 成功,则返回 napi_ok
。如果传入不可分离的 ArrayBuffer
,则返回 napi_detachable_arraybuffer_expected
。
¥Returns napi_ok
if the API succeeded. If a non-detachable ArrayBuffer
is
passed in it returns napi_detachable_arraybuffer_expected
.
通常,ArrayBuffer
是不可拆卸的,如果它之前已经拆卸过。引擎可能会对 ArrayBuffer
是否可拆卸施加附加条件。例如,V8 要求 ArrayBuffer
是外部的,即用 napi_create_external_arraybuffer
创建的。
¥Generally, an ArrayBuffer
is non-detachable if it has been detached before.
The engine may impose additional conditions on whether an ArrayBuffer
is
detachable. For example, V8 requires that the ArrayBuffer
be external,
that is, created with napi_create_external_arraybuffer
.
此 API 表示调用 ArrayBuffer
分离操作,如 ECMAScript 语言规范的 第 24.1.1.3 节 中所定义。
¥This API represents the invocation of the ArrayBuffer
detach operation as
defined in Section 24.1.1.3 of the ECMAScript Language Specification.