File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -2034,15 +2034,18 @@ added: REPLACEME
20342034* Returns: {boolean}
20352035
20362036Returns ` true ` if the value is a built-in [` ArrayBuffer ` ][] and
2037- is detached. Detached arrays have a byte length of 0, which prevents
2038- JavaScript from ever accessing underlying backing store.
2039-
2040- For example, we can end up with a detached buffer when using a BYOB
2041- (bring your own buffer) on a ReadableStream.
2037+ is detached. For example, we can end up with a detached buffer
2038+ when using a BYOB (bring your own buffer) on a ReadableStream.
2039+ Detached arrays have a ` byteLength` of 0, and their contents can
2040+ not be accessed in JavaScript.
20422041
20432042` ` ` js
20442043util .types .isArrayBufferDetached (null ); // Returns false
20452044util .types .isArrayBufferDetached (new ArrayBuffer ()); // Returns false
2045+
2046+ const { buffer } = new Uint8Array ([1 , 2 , 3 ]);
2047+ new MessageChannel ().port1 .postMessage (' ' , [buffer]);
2048+ util .types .isArrayBufferDetached (buffer); // Returns true
20462049` ` `
20472050
20482051### ` util .types .isArrayBufferView (value)`
You can’t perform that action at this time.
0 commit comments