# An easy way to detect if an array buffer is detached?

**URL:** <https://es.discourse.group/t/an-easy-way-to-detect-if-an-array-buffer-is-detached/458>\
**Category:** 💡 Ideas\
**Created:** [September 7, 2020, 7:23am UTC](https://es.discourse.group/t/an-easy-way-to-detect-if-an-array-buffer-is-detached/458 "2020-09-07T07:23:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![claudiameadows](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/claudiameadows/32/126_2.png) [@claudiameadows](https://es.discourse.group/u/claudiameadows)\
**Post date:** [September 7, 2020, 7:23am UTC](https://es.discourse.group/t/an-easy-way-to-detect-if-an-array-buffer-is-detached/458/1 "2020-09-07T07:23:28Z")

</div>

For as much as [IsDetachedBuffer](https://tc39.es/ecma262/#sec-isdetachedbuffer) is called, both in the ES spec and elsewhere (like the HTML spec), to see if an error needs thrown, it'd be nice if that were exposed at the API level as a getter. It'd make checking certain invariants (for testing and runtime assertions) much easier than hacks with checking if accessing a certain property or invoking a certain function throws.

---

<div class="post-metadata">

**Author:** ![aclaymore](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aclaymore/32/501_2.png) [@aclaymore](https://es.discourse.group/u/aclaymore)\
**Post date:** [November 27, 2024, 4:15am UTC](https://es.discourse.group/t/an-easy-way-to-detect-if-an-array-buffer-is-detached/458/2 "2024-11-27T04:15:25Z")

</div>

It happened: [ArrayBuffer.prototype.detached - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/detached) 🎉
