@@ -453,6 +453,8 @@ typedef enum {
453
453
napi_closing,
454
454
napi_bigint_expected,
455
455
napi_date_expected,
456
+ napi_arraybuffer_expected,
457
+ napi_detachable_arraybuffer_expected,
456
458
} napi_status;
457
459
```
458
460
@@ -3232,6 +3234,30 @@ Returns `napi_ok` if the API succeeded.
3232
3234
This API represents the invocation of the Strict Equality algorithm as
3233
3235
defined in [Section 7.2.14][] of the ECMAScript Language Specification.
3234
3236
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
+
3235
3261
## Working with JavaScript Properties
3236
3262
3237
3263
N-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.
5216
5242
[Section 22.1]: https://tc39.github.io/ecma262/#sec-array-objects
5217
5243
[Section 22.2]: https://tc39.github.io/ecma262/#sec-typedarray-objects
5218
5244
[Section 24.1]: https://tc39.github.io/ecma262/#sec-arraybuffer-objects
5245
+ [Section 24.1.1.3]: https://tc39.es/ecma262/#sec-detacharraybuffer
5219
5246
[Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects
5220
5247
[Section 25.4]: https://tc39.github.io/ecma262/#sec-promise-objects
5221
5248
[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type
0 commit comments