@@ -453,6 +453,8 @@ typedef enum {
453453 napi_closing,
454454 napi_bigint_expected,
455455 napi_date_expected,
456+ napi_arraybuffer_expected,
457+ napi_detachable_arraybuffer_expected,
456458} napi_status;
457459```
458460
@@ -3232,6 +3234,30 @@ Returns `napi_ok` if the API succeeded.
32323234This API represents the invocation of the Strict Equality algorithm as
32333235defined in [Section 7.2.14][] of the ECMAScript Language Specification.
32343236
3237+ ### napi_detach_arraybuffer
3238+ <!-- YAML
3239+ added: REPLACEME
3240+ -->
3241+
3242+ ```C
3243+ napi_status napi_detach_arraybuffer(napi_env env,
3244+ napi_value arraybuffer)
3245+ ```
3246+
3247+ * `[in] env`: The environment that the API is invoked under.
3248+ * `[in] arraybuffer`: The JavaScript `ArrayBuffer` to be detached.
3249+
3250+ Returns `napi_ok` if the API succeeded. If a non-detachable `ArrayBuffer` is
3251+ passed in it returns `napi_detachable_arraybuffer_expected`.
3252+
3253+ Generally, an `ArrayBuffer` is non-detachable if it has been detached before.
3254+ The engine may impose additional conditions on whether an `ArrayBuffer` is
3255+ detachable. For example, V8 requires that the `ArrayBuffer` be external,
3256+ that is, created with [`napi_create_external_arraybuffer`][].
3257+
3258+ This API represents the invocation of the `ArrayBuffer` detach operation as
3259+ defined in [Section 24.1.1.3][] of the ECMAScript Language Specification.
3260+
32353261## Working with JavaScript Properties
32363262
32373263N-API exposes a set of APIs to get and set properties on JavaScript
@@ -5216,6 +5242,7 @@ This API may only be called from the main thread.
52165242[Section 22.1]: https://tc39.github.io/ecma262/#sec-array-objects
52175243[Section 22.2]: https://tc39.github.io/ecma262/#sec-typedarray-objects
52185244[Section 24.1]: https://tc39.github.io/ecma262/#sec-arraybuffer-objects
5245+ [Section 24.1.1.3]: https://tc39.es/ecma262/#sec-detacharraybuffer
52195246[Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects
52205247[Section 25.4]: https://tc39.github.io/ecma262/#sec-promise-objects
52215248[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type
0 commit comments