@@ -265,6 +265,8 @@ typedef enum {
265265 napi_closing,
266266 napi_bigint_expected,
267267 napi_date_expected,
268+ napi_arraybuffer_expected,
269+ napi_detachable_arraybuffer_expected,
268270} napi_status;
269271```
270272If additional information is required upon an API returning a failed status,
@@ -2946,6 +2948,30 @@ defined in
29462948[Section 7.2.14](https://tc39.github.io/ecma262/#sec-strict-equality-comparison)
29472949of the ECMAScript Language Specification.
29482950
2951+ ### napi_detach_arraybuffer
2952+ <!-- YAML
2953+ added: REPLACEME
2954+ -->
2955+
2956+ ```C
2957+ napi_status napi_detach_arraybuffer(napi_env env,
2958+ napi_value arraybuffer)
2959+ ```
2960+
2961+ * `[in] env`: The environment that the API is invoked under.
2962+ * `[in] arraybuffer`: The JavaScript `ArrayBuffer` to be detached.
2963+
2964+ Returns `napi_ok` if the API succeeded. If a non-detachable `ArrayBuffer` is
2965+ passed in it returns `napi_detachable_arraybuffer_expected`.
2966+
2967+ Generally, an `ArrayBuffer` is non-detachable if it has been detached before.
2968+ The engine may impose additional conditions on whether an `ArrayBuffer` is
2969+ detachable. For example, V8 requires that the `ArrayBuffer` be external,
2970+ that is, created with [`napi_create_external_arraybuffer`][].
2971+
2972+ This API represents the invocation of the `ArrayBuffer` detach operation as
2973+ defined in [Section 24.1.1.3][] of the ECMAScript Language Specification.
2974+
29492975## Working with JavaScript Properties
29502976
29512977N-API exposes a set of APIs to get and set properties on JavaScript
@@ -4889,6 +4915,7 @@ This API may only be called from the main thread.
48894915[Section 22.1]: https://tc39.github.io/ecma262/#sec-array-objects
48904916[Section 22.2]: https://tc39.github.io/ecma262/#sec-typedarray-objects
48914917[Section 24.1]: https://tc39.github.io/ecma262/#sec-arraybuffer-objects
4918+ [Section 24.1.1.3]: https://tc39.es/ecma262/#sec-detacharraybuffer
48924919[Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects
48934920[Section 25.4]: https://tc39.github.io/ecma262/#sec-promise-objects
48944921[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type
0 commit comments